一、此方法只适应于调式的时候用,或者调试完成后,为关机可以使用,设备关机后此方法无效。
[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 bInh