mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[KBSWITCH]
Properly use the single instance mutex svn path=/trunk/; revision=56160
This commit is contained in:
parent
a339649110
commit
73a2ef371a
1 changed files with 11 additions and 2 deletions
|
@ -519,9 +519,15 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdSh
|
|||
HANDLE hMutex;
|
||||
|
||||
hMutex = CreateMutex(NULL, FALSE, szKbSwitcherName);
|
||||
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
|
||||
if (!hMutex)
|
||||
return 1;
|
||||
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
CloseHandle(hMutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
hInst = hInstance;
|
||||
hProcessHeap = GetProcessHeap();
|
||||
|
||||
|
@ -537,7 +543,10 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdSh
|
|||
WndClass.lpszClassName = szKbSwitcherName;
|
||||
|
||||
if (!RegisterClass(&WndClass))
|
||||
{
|
||||
CloseHandle(hMutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CreateWindow(szKbSwitcherName, NULL, 0, 0, 0, 1, 1, HWND_DESKTOP, NULL, hInstance, NULL);
|
||||
|
||||
|
@ -547,7 +556,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, INT nCmdSh
|
|||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (hMutex) CloseHandle(hMutex);
|
||||
CloseHandle(hMutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue