Guest User

Untitled

a guest
Apr 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.55 KB | None | 0 0
  1. #include <windows.h>
  2. #include <commctrl.h>
  3. #include <time.h>
  4. #include "resource.h"
  5.  
  6. unsigned int i=0;
  7. unsigned int timer=30;
  8.  
  9. BOOL CALLBACK DlgProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam)
  10. {
  11.      switch(Message)
  12.      {
  13.                     case WM_CLOSE:
  14.                          EndDialog(hwnd,0);
  15.                          break;
  16.                          case WM_COMMAND:
  17.                               switch(LOWORD(wParam))
  18.                               {
  19.                                                     case ID_BTABOUT:
  20.                                                          DialogBox(NULL,MAKEINTRESOURCE(IDD_ABOUT),NULL,DlgProc);
  21.                                                          break;
  22.                                                          case ID_ABOUTEXIT:
  23.                                                               EndDialog(hwnd,0);
  24.                                                               break;
  25.                                                          case ID_BTRESET:
  26.                                                               {
  27.                                                                          timer=30;
  28.                                                                          i=0;
  29.                                                                          SetDlgItemInt(hwnd,ID_TTIMER,timer,FALSE);
  30.                                                                          SetDlgItemInt(hwnd,ID_TCOUNT,i,FALSE);
  31.                                                                          }
  32.                                                                          break;
  33.                                                 case ID_BTCLICK:
  34.                                                      for(timer=30;timer>=0;timer--)
  35.                                                      {
  36.                                                                                    Sleep(1000);
  37.                                                                                    SetDlgItemInt(hwnd,ID_TTIMER,timer,FALSE);
  38.                                                                                    if(timer==0)
  39.                                                                                    {
  40.                                                                                                break;
  41.                                                                                                }
  42.                                                                                    }
  43.                                                          {            
  44.                                                                    i++;
  45.                                                                     SetDlgItemInt(hwnd,ID_TCOUNT,i,FALSE);
  46.                                                                     }
  47.                                                                     break;
  48.                                                          }
  49.                                                          break;
  50.                          case WM_DESTROY:
  51.                               EndDialog(hwnd,0);
  52.                               break;
  53.                               default:
  54.                                       return FALSE;
  55.                                       }
  56.                                       return TRUE;
  57.                                       }
  58. int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
  59. {
  60.     InitCommonControls();
  61.     return DialogBox(hInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,DlgProc);
  62. }
Add Comment
Please, Sign In to add comment