1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| signed char _minMaxStatus = 0;
static LRESULT CALLBACK _wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
if (message == WM_CLOSE) {
PostQuitMessage(0);
return 0;
} else if (message == WM_SYSCOMMAND) {
char buf[256] = "";
if (wParam == SC_MINIMIZE) {
_minMaxStatus = -1;
SetWindowText(hwnd, "MINIMIZED");
} else if (wParam == SC_MAXIMIZE) {
_minMaxStatus = 1;
SetWindowText(hwnd, "MAXIMIZED");
} else if (wParam == SC_RESTORE) {
sprintf(buf, "RESTORED : %s", _minMaxStatus == -1 ? "from MINIMIZE" :
_minMaxStatus == 1 ? "from MAXIMIZE" :
"Whot !?");
_minMaxStatus = 0;
SetWindowText(hwnd, buf);
}
}
return (DefWindowProc(hwnd, message, wParam, lParam));
} |
Partager