mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 02:06:36 +02:00
Fixed some warnings and added code to close active windows on disable (#2915)
This commit is contained in:
@@ -61,10 +61,10 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||
windowClass.hIcon = (HICON)LoadImageW(
|
||||
windowClass.hInstance,
|
||||
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
|
||||
IMAGE_ICON,
|
||||
48,
|
||||
48,
|
||||
MAKEINTRESOURCE(IDS_KEYBOARDMANAGER_ICON),
|
||||
IMAGE_ICON,
|
||||
48,
|
||||
48,
|
||||
LR_DEFAULTCOLOR);
|
||||
if (RegisterClassEx(&windowClass) == NULL)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ void createEditShortcutsWindow(HINSTANCE hInst, KeyboardManagerState& keyboardMa
|
||||
HWND _hWndEditShortcutsWindow = CreateWindow(
|
||||
szWindowClass,
|
||||
L"Remap Shortcuts",
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MAXIMIZEBOX,
|
||||
(desktopRect.right / 2) - (windowWidth / 2),
|
||||
(desktopRect.bottom / 2) - (windowHeight / 2),
|
||||
windowWidth,
|
||||
@@ -377,3 +377,13 @@ bool CheckEditShortcutsWindowActive()
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Function to close any active Edit Shortcuts window
|
||||
void CloseActiveEditShortcutsWindow()
|
||||
{
|
||||
std::unique_lock<std::mutex> hwndLock(editShortcutsWindowMutex);
|
||||
if (hwndEditShortcutsNativeWindow != nullptr)
|
||||
{
|
||||
PostMessage(hwndEditShortcutsNativeWindow, WM_CLOSE, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user