Fixed single instance bug

This commit is contained in:
Dennis Fokin 2022-05-31 12:56:00 +02:00
parent a348befb3d
commit 14afe02125
No known key found for this signature in database
GPG Key ID: 870B88256690D8BC

View File

@ -110,7 +110,7 @@ bool Win32Window::CreateAndShow(const std::wstring& title,
// Attempt to create a mutex to enforce single instance. // Attempt to create a mutex to enforce single instance.
CreateMutex(NULL, TRUE, L"com.yubico.authenticator.mutex"); CreateMutex(NULL, TRUE, L"com.yubico.authenticator.mutex");
if (GetLastError() == ERROR_ALREADY_EXISTS) { if (GetLastError() == ERROR_ALREADY_EXISTS) {
HWND handle=FindWindowA(NULL, "Yubico Authenticator"); HWND handle=FindWindow(L"FLUTTER_RUNNER_WIN32_WINDOW", L"Yubico Authenticator");
WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) }; WINDOWPLACEMENT place = { sizeof(WINDOWPLACEMENT) };
GetWindowPlacement(handle, &place); GetWindowPlacement(handle, &place);
switch(place.showCmd) { switch(place.showCmd) {