Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <commctrl.h>
- #include <time.h>
- #include "resource.h"
- unsigned int i=0;
- unsigned int timer=30;
- BOOL CALLBACK DlgProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam)
- {
- switch(Message)
- {
- case WM_CLOSE:
- EndDialog(hwnd,0);
- break;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case ID_BTABOUT:
- DialogBox(NULL,MAKEINTRESOURCE(IDD_ABOUT),NULL,DlgProc);
- break;
- case ID_ABOUTEXIT:
- EndDialog(hwnd,0);
- break;
- case ID_BTRESET:
- {
- timer=30;
- i=0;
- SetDlgItemInt(hwnd,ID_TTIMER,timer,FALSE);
- SetDlgItemInt(hwnd,ID_TCOUNT,i,FALSE);
- }
- break;
- case ID_BTCLICK:
- for(timer=30;timer>=0;timer--)
- {
- Sleep(1000);
- SetDlgItemInt(hwnd,ID_TTIMER,timer,FALSE);
- if(timer==0)
- {
- break;
- }
- }
- {
- i++;
- SetDlgItemInt(hwnd,ID_TCOUNT,i,FALSE);
- }
- break;
- }
- break;
- case WM_DESTROY:
- EndDialog(hwnd,0);
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
- {
- InitCommonControls();
- return DialogBox(hInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,DlgProc);
- }
Add Comment
Please, Sign In to add comment