File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ DWORD GetProcessIdFromExe(const std::wstring& exeName) {
66
66
return 0 ; // Not found
67
67
}
68
68
69
+
69
70
// Callback function to find the window associated with a given process ID
70
71
BOOL CALLBACK WindowToForeground (HWND hwnd, LPARAM lParam) {
71
72
DWORD processId;
@@ -77,8 +78,14 @@ BOOL CALLBACK WindowToForeground(HWND hwnd, LPARAM lParam) {
77
78
std::wstring title = windowTitle;
78
79
// Bring the window to the foreground
79
80
if (title.rfind (L" OBS " , 0 ) == 0 ) { // the main OBS window title starts with 'OBS '
81
+ bool maximized = IsZoomed (hwnd);
82
+ bool minimized = IsIconic (hwnd);
83
+ if (!minimized) {
84
+ ShowWindow (hwnd, maximized ? SW_SHOWMAXIMIZED : SW_SHOW);
85
+ } else {
86
+ ShowWindow (hwnd, SW_RESTORE);
87
+ }
80
88
SetForegroundWindow (hwnd);
81
- ShowWindow (hwnd, SW_SHOW);
82
89
return FALSE ; // Stop enumerating windows (we found the window)
83
90
}
84
91
}
You can’t perform that action at this time.
0 commit comments