Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INT_PTR CALLBACK Timer(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
- {
- int counter = 0, choice = 0;
- static int step = 1;
- BOOL* LPt = NULL;
- BOOL SIG = TRUE;
- UNREFERENCED_PARAMETER(lParam);
- switch (message)
- {
- case WM_INITDIALOG:
- SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
- SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETSTEP, step, 0);
- return (INT_PTR)TRUE;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hDlg, LOWORD(wParam));
- return (INT_PTR)TRUE;
- }
- else if (LOWORD(wParam) == IDC_BUTTON1)
- {
- SetTimer(hDlg, TIMER1, 20, NULL);
- }
- break;
- case WM_TIMER:
- if (GetDlgItemInt(hDlg, IDC_EDIT1, LPt, SIG) == 100)
- {
- KillTimer(hDlg, TIMER1);
- choice = MessageBox(hDlg, "ДА спре ли таймера?", "Избор", MB_YESNO);
- switch (choice)
- {
- case IDYES:
- EndDialog(hDlg, LOWORD(wParam));
- break;
- case IDNO:
- counter = 0;
- SetDlgItemInt(hDlg, IDC_EDIT1, counter, SIG);
- SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_SETPOS, 0, 0);
- SetTimer(hDlg, TIMER1, 20, NULL);
- break;
- }
- }
- else
- {
- counter = GetDlgItemInt(hDlg, IDC_EDIT1, LPt, SIG);
- counter++;
- SetDlgItemInt(hDlg, IDC_EDIT1, counter, SIG);
- if (SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_GETPOS, 0, 0) < 100)
- {
- SendDlgItemMessage(hDlg, IDC_PROGRESS1, PBM_STEPIT, 0, 0);
- }
- }
- break;
- }
- return (INT_PTR)FALSE;
- }
Add Comment
Please, Sign In to add comment