Find process id of my application [Resolved]

Posted by RohiK under C# on 1/14/2011 | Points: 10 | Views : 24086 | Status : [Member] | Replies : 4
Hi,

I am creating windows form application in c# ,when I will setup it into any pc and run it .
I want to go further by adding functionality like if same application in running on my pc then nobody will start my application again
thats why I need to check my application procress id or my application name in task manager..

How to do that ?

plz help

Happy Programming!!
Rohi



Responses

Posted by: Karthikanbarasan on: 1/14/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi Rohi,

Here is the sample code.

System.Diagnostics.Process CurrentPro = new System.Diagnostics.Process();

CurrentPro = System.Diagnostics.Process.GetCurrentProcess();
MessageBox.Show(CurrentPro.Id.ToString());



Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 1/17/2011 [Member] Starter | Points: 25

Up
0
Down
ya i found it!
thanks !

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 1/17/2011 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down
Hai Rohi,

If a particular answer solved your requirement kindly make the post as resolved. It will help remaining users too.. This is my suggestion..


Thanks,
Radha Srikanth

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/17/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Thanks Radha Srikanth for suggestion...

It will be really good to follow this so that users in future can use the solution for similar issues.

Thanks
Karthik
www.f5Debug.net

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response