You are not supposed to perform WM_SYSCOMMANDs by posting a message to HWND_BROADCAST, see Fumbling around in the dark and stumbling across the wrong solution. You should send the message to a single HWND that you own or call DefWindowProc directly...