all groups > dotnet compact framework > july 2007 >
You're in the

dotnet compact framework

group:

Check if app is already running?


Check if app is already running? Dan
7/30/2007 1:42:26 PM
dotnet compact framework:
Can anyone point me in the right direction to check if the application is
already running for a .NET CF 2.0 application?

Code for the regular .NET framework does not work because it uses
process.GetCurrentProcess.MainWindowHandle

which is not supported in the CF.



Dan

Re: Check if app is already running? Erwin Zwart
7/31/2007 12:00:00 AM
You need to P/Invoke CreateToolhelp32Snapshot, Process32First and
Process32Next .
you can also use OpenNetCF.org and use the OpenNETCF.Toolhelp namespace.

Hope this helps

Erwin Zwart

[quoted text, click to view]

Re: Check if app is already running? ctacke/
7/31/2007 6:45:19 AM
For your own process just create a named system mutex (P/Invoke CreateMutex
or use the OpenNETCF.Threading.NamedMutex). On startup, create and hold it.
If it already exists at that point, you know another instance is running.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com



[quoted text, click to view]

AddThis Social Bookmark Button