@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: On mobile devices running Windows mobile 5.0, if you need to prevent another instance of your application to load the CreateMutex function can be of good use: !!!!C# Signature: [DllImport("coredll.dll", SetLastError=true)] public static extern int CreateMutex(IntPtr lpMutexAttributes, bool bInitiaOwner, string lpName); // Not needed due to using the SetLastError=true // use Marshal.GetLastWin32Error() to retrieve the error. //[DllImport("coredll.dll")] //public static extern int GetLastError(); !!!!User-Defined Types: const int ERROR_ALREADY_EXISTS = 183; !!!!Notes: It should be used in conjunction with Marshal.GetLastWin32Error() to check the application already existed in the process list. !!!!Sample Code: private static bool CheckInstance() { CreateMutex(IntPtr.Zero, true, "<Application Name>"); // to be replaced by the name of your application return Marshal.GetLastWin32Error() == ERROR_ALREADY_EXISTS; } Documentation: CreateMutex@msdn on MSDN
Edit coredll.createmutex
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.