c#)我想利用Mutex来使程序只运行一份实例:
...
bool canCreate;
Mutex myMutex = new Mutex(true, "MutexNameString", out canCreate);
if(canCreate)
{
...
}
else
{
IntPtr hWnd = FindWindow(lpClassName, null);
ShowWindowAsync(hWnd, 1);
SetForegroundWindow(hWnd);
}
这里的lpClassName我是通过spy++查到的,有没有什么函数可以直接取得呢?
大话西游666
相关分类