The problem was in the messages handling, i belive. I changed to PeekMessage from GetMessage. is this Ok? while (true) { if(PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&message); DispatchMessage(&message); } checkalarm(); // func.to check if the window is to restore } return message.wParam; } return message.wParam; }