-
Notifications
You must be signed in to change notification settings - Fork 0
/
windowChange.c
39 lines (32 loc) · 927 Bytes
/
windowChange.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <windows.h>
HWND hWnd = NULL;
void HideTitleBar() {
if (!hWnd) {
hWnd = FindWindow(NULL, "EasyCanvas");
}
// Retrieve the current window style.
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
// Remove WS_CAPTION style to hide the title bar.
style &= ~(WS_CAPTION);
// Apply the new style.
SetWindowLongPtr(hWnd, GWL_STYLE, style);
// Set the window position and size to force the change to take effect.
SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
}
void UnminimizeLoop() {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (!hWnd) {
hWnd = FindWindow(NULL, "EasyCanvas");
}
while (1) {
Sleep(100);
if (!IsZoomed(hWnd)) {
GetWindowPlacement(hWnd, &wp);
wp.showCmd = SW_SHOWNOACTIVATE;
SetWindowPlacement(hWnd, &wp);
}
Sleep(100);
}
}