Monday, March 24, 2008

Single Instance Applications is a lot easier in VB 2005

For more information, read the following post:

http://blogs.msdn.com/tyler_whitney/archive/2005/11/23/VB-Application-Model.aspx


From the article:

So what's a Single-Instance application?  Imagine launching an application where additional attempts to launch the app while the first one is running doesn't actually launch a new instance of the app.  Instead the original instance of the app gets notified that another launch attempt occurred.  When we introduced an application model for Visual Basic in VB 2005, one of the things we wanted to do is make it drop-dead easy to create single-instance applications.


Pretty much what you need to do in VB 2005 is to right click on your main project and go to properties. 
then select Application, then make sure you have "Enable application framework" checked.

Then check of "Make single instance application"

For the other items. I have everything checked, and the authentication mode, I chose Windows, and the shutdown mode, I chose When startup form closes, and for the Splash screen, I have code that takes care of this.

Either way, this is a lot easier than writing code in order to make this happen properly.

-- Ted


No comments: