Because you are not breaking or returning after the Test button's code. The case is falling through to the WM_CLOSE code.
Code:int CALLBACK DlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: if (LOWORD(wParam) == IDC_BTN_TEST) { iCount = ((GetTickCount() / 1000) / 60); ltoa(iCount, szTicks, 10); MessageBox(hWndDlg, szTicks, "Counter", MB_OK); return false; } if(LOWORD(wParam) == IDC_BTN_CANCEL) { MessageBox(hWndDlg, "Cancel pressed!", "Button", MB_OK); } if(LOWORD(wParam) == IDC_BTN_OK) { MessageBox(hWndDlg, "OK pressed!", "Button", MB_OK); return false; } case WM_CLOSE: EndDialog(hWndDlg, 0); PostQuitMessage(0); break; } return false; }![]()




Reply With Quote