Skip to content

Commit 63b74a7

Browse files
author
Simon Hofmann
committed
(#17) Handling of possible value for
1 parent b81d49e commit 63b74a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/win32/window_manager.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ std::vector<WindowHandle> getWindows() {
1818
}
1919

2020
WindowHandle getActiveWindow() {
21-
return reinterpret_cast<WindowHandle>(GetForegroundWindow());
21+
HWND foregroundWindow = GetForegroundWindow();
22+
if (foregroundWindow != NULL) {
23+
return reinterpret_cast<WindowHandle>(foregroundWindow);
24+
}
25+
return -1;
2226
}
2327

2428
MMRect getWindowRect(const WindowHandle windowHandle) {

0 commit comments

Comments
 (0)