commit f6d0181c5ce581893f14bb118b8e68777ff46f45
parent 44010caed009d1ae8e2734a90ceba4f7fb5b1481
Author: Konjahin Anton <koniahin.ant@yandex.ru>
Date: Sun, 18 Jun 2017 11:53:22 +0300
Fix bug with maximizing app on tablets
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
@@ -60,6 +60,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
if (hit == HTCLIENT) hit = HTCAPTION;
return hit;
+ case WM_WINDOWPOSCHANGING:
+ // forbid window maximization
+ ((WINDOWPOS*) lParam)->flags |= SWP_NOSIZE;
+ return 1;
+
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
@@ -75,14 +80,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
- wc.hbrBackground = 0;
+ wc.hbrBackground = 1;
wc.lpszClassName = className;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wc);
- HWND hwnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_TOPMOST | WS_EX_NOACTIVATE, className,
- "Keytune", WS_POPUP | WS_VISIBLE | WS_SYSMENU, CW_USEDEFAULT,
+ HWND hwnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_TOPMOST | WS_EX_NOACTIVATE | WS_THICKFRAME,
+ className, "Keytune", WS_POPUP | WS_VISIBLE | WS_SYSMENU, CW_USEDEFAULT,
CW_USEDEFAULT, 160, 60, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);