Groups | Blog | Home
all groups > dotnet windows forms > february 2008 >

dotnet windows forms : Single instance app


rowe_newsgroups
2/12/2008 7:37:38 AM
[quoted text, click to view]

Look at your project properties, I do believe there is a check box
there.

Also, did you even search for this before posting?

Thanks,

zacks@construction-imaging.com
2/12/2008 7:56:50 AM
[quoted text, click to view]

That is only applicable if you have the "Enable Visual Styles"
checkbox on. I don't know about you, but I prefer to configure VB.NET
apps the same way C#.NET does by default, and have the startup object
as SubMain, enable visual styles there manually and open the main form
with an Application.Run call.

So in that situation I guess you would have to resort to using a mutex
John
2/12/2008 3:28:24 PM
Hi

Is there a way to ensure that an app is only run once and if it is run twice
it terminates?

Thanks

Regards

John
2/12/2008 3:57:07 PM
Hi

Thanks for that. I need to quit the app as soon as it starts but
Application.Quit is not available in
Sub MyApplication_StartupNextInstance event. What can I do to quit the app
as soon as it starts the second time?

Thanks for your help.

Regards

[quoted text, click to view]

Herfried K. Wagner [MVP]
2/12/2008 6:05:03 PM
<zacks@construction-imaging.com> schrieb:
[quoted text, click to view]

You could use 'System.Threading.Mutex' to prevent multiple instances:

FAQ for the microsoft.public.languages.csharp newsgroup
<URL:http://www.yoda.arachsys.com/csharp/faq/#one.application.instance>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
Scott M.
2/12/2008 7:23:13 PM
[quoted text, click to view]

Are you sure about that? I thought it was available if you've chosen to
"Enable Application Frameworks".

Shuja Ali Zaroo
2/12/2008 10:06:46 PM
There is no need for Application.Quit. The .NET Runtime will take care of
that once you have checked the Make Single Instance Application. You can
even bring the previous instance to front using "e.BringToForeground = True"
in the same event handler.

Regards,
Shuja

[quoted text, click to view]
Herfried K. Wagner [MVP]
2/13/2008 1:44:02 AM
"Scott M." <smar@nospam.nospam> schrieb:
[quoted text, click to view]

C# doesn't support the application framework.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
AddThis Social Bookmark Button