http://www.cnblogs.com/answer/archive/2007/07/06/808418.html
#region Api_Call CreateMutex;
IntPtr hMutex;
hMutex = CreateMutex(null, false, "Manager");
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
Application.Run(new FrmMainForm());
}
else
{
ReleaseMutex(hMutex);
}
#endregion
const int ERROR_ALREADY_EXISTS = 0183;
[DllImport("coredll.Dll")]
private static extern int GetLastError();
[DllImport("coredll.Dll")]
private static extern int ReleaseMutex(IntPtr hMutex);
[DllImport("coredll.Dll")]
private static extern IntPtr CreateMutex(SECURITY_ATTRIBUTES lpMutexAttributes, bool bInitialOwner, string lpName);
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public int lpSecurityDescriptor;
public int bInheritHandle;
}