此帖出自嵌入式系统论坛
最新回复
#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;
}
详情
回复
发表于 2010-5-7 16:36
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
浏览过的版块 |
EEWorld Datasheet 技术支持