Windows Develop Bookmark and Share   
 index > Windows Forms General > Check instance for simple desktop application??
 

Check instance for simple desktop application??

how to check instance for simple desktop application??
im .net developer
Jayesh B Sharma  Tuesday, December 30, 2008 9:42 AM

If you want to check whether there is a previous instance running for application you can use following code

PublicSubCheckForInstance()
IfProcess.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length>1Then
MsgBox("Applicationisalreadyrunning")
EndIf
EndSub

You can also check for previous instance using mutex.

http://www.freevbcode.com/ShowCode.Asp?ID=5845


If you only want to allow one instance of application, you can select the checkbox "Make Single Instance Application" in Project->Application Properties and handleStartNextInstance event.


Gaurav Khanna
Khanna Gaurav  Tuesday, December 30, 2008 11:55 AM

If you want to check whether there is a previous instance running for application you can use following code

PublicSubCheckForInstance()
IfProcess.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length>1Then
MsgBox("Applicationisalreadyrunning")
EndIf
EndSub

You can also check for previous instance using mutex.

http://www.freevbcode.com/ShowCode.Asp?ID=5845


If you only want to allow one instance of application, you can select the checkbox "Make Single Instance Application" in Project->Application Properties and handleStartNextInstance event.


Gaurav Khanna
Khanna Gaurav  Tuesday, December 30, 2008 11:55 AM
thanks Gaurav , its really helped me...
im .net developer
Jayesh B Sharma  Tuesday, December 30, 2008 1:38 PM

You can use google to search for other answers

Custom Search

More Threads

• Converted to 2008 - got MissingManifestResourceException
• Creating a "Now Loading" Form whenever a Form closes in a multi Form C# windows moblie 5.0 application
• Problem with Screensaver
• Saving Data from parent form.
• Getting Mouse Wheel to scroll tab
• C# drag and drop
• Cursor.Hide() not working???
• MDI windows.
• WebBrowser control and html document(simple question)
• make search button based on access database