Whats wrong:Code:#include <windows.h> #include "Resource.h" #define ID_TIMER 1 void OnInitDialog(HWND hDlg); BOOL CALLBACK APP_DlgProc(HWND, UINT, WPARAM, LPARAM); int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevious, LPTSTR lpsz, int iCmd) { // Run main dialog BOOL b = DialogBox(hInstance, "DLG_MAIN", NULL, APP_DlgProc); return b; } BOOL CALLBACK APP_DlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { int timer = 60; char timer_str[10]; switch(uiMsg) { case WM_INITDIALOG: OnInitDialog(hDlg); break; case WM_COMMAND: switch(wParam) { case IDCANCEL: EndDialog(hDlg, FALSE); return FALSE; case IDC_START: SetTimer(hDlg, ID_TIMER, 1000, NULL); break; case IDC_STOP: KillTimer(hDlg, ID_TIMER); break; case ID_TIMER: itoa(timer, timer_str, 10); if(timer == 0) { KillTimer(hDlg, ID_TIMER); } else { timer--; } SetDlgItemText(hDlg, IDC_SECONDS, timer_str); break; } break; } return FALSE; } void OnInitDialog(HWND hDlg) { }



LinkBack URL
About LinkBacks


