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
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 "Dan" wrote in message news:Ober4Et0HHA.600@TK2MSFTNGP05.phx.gbl... > 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 > >
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 "Dan" wrote in message news:Ober4Et0HHA.600@TK2MSFTNGP05.phx.gbl... > 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 > >