daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define SCREEN_WIDTH 700
  2. #define SCREEN_HEIGHT 600
  3. #define ID_BUTTONEURO 1
  4. #define ID_BUTTONZLOTOWKI 2
  5. #define ID_BUTTONFUNTY 3
  6. #define ID_CUSTOMERVALUE 4
  7. #define ID_ENDINGVALUE 5
  8. #include <windows.h>
  9. #include <tchar.h>
  10.  
  11. TCHAR className[] = TEXT("NazwaKlasy");
  12. TCHAR appName[] = TEXT("Stoperan");
  13.  
  14. HWND hwnd;
  15. MSG msg;
  16.  
  17. LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  18. {
  19.     //
  20.      TCHAR wyn[10];
  21.      DWORD dlugosc;
  22.     LPSTR Bufor;
  23.     //
  24.     static RECT R;
  25.     static HWND ButtonEuro,ButtonZlotowki,ButtonFunty,CustomerValue,EndingValue;
  26.     switch (msg)
  27.     {
  28.     case WM_CREATE:
  29.     {
  30.        
  31.         GetClientRect(hwnd, &R);
  32.         HINSTANCE &hInstance=((LPCREATESTRUCT)lParam)->hInstance;
  33.         CustomerValue=CreateWindowEx(0,TEXT("EDIT"),TEXT(""),WS_CHILD|WS_VISIBLE|WS_BORDER,0,0,0,0,hwnd,(HMENU)ID_CUSTOMERVALUE,hInstance,0);
  34.         ButtonEuro=CreateWindowEx(0,TEXT("BUTTON"),TEXT("Euro"),WS_CHILD|WS_VISIBLE|BS_CHECKBOX,0,0,0,0,hwnd,(HMENU)ID_BUTTONEURO,hInstance,0);
  35.         ButtonFunty=CreateWindowEx(0,TEXT("BUTTON"),TEXT("Funty"),WS_CHILD|WS_VISIBLE|BS_CHECKBOX,0,0,0,0,hwnd,(HMENU)ID_BUTTONFUNTY,hInstance,0);
  36.         ButtonZlotowki=CreateWindowEx(0,TEXT("BUTTON"),TEXT("LICZ"),WS_CHILD|WS_VISIBLE,0,0,0,0,hwnd,(HMENU)ID_BUTTONZLOTOWKI,hInstance,0);
  37.             EndingValue=CreateWindowEx(0,TEXT("STATIC"),TEXT("Wynik"),WS_CHILD|WS_VISIBLE|WS_BORDER,0,0,0,0,hwnd,(HMENU)ID_ENDINGVALUE,hInstance,0);
  38.     }break;
  39.  
  40.     case WM_SIZE:
  41.     {
  42.         GetClientRect(hwnd, &R);
  43.         MoveWindow(ButtonEuro,R.right/3,R.bottom/3,R.right/7,R.bottom/15,1);
  44.         MoveWindow(ButtonFunty,R.right/2,R.bottom/3,R.right/7,R.bottom/15,1);
  45.         MoveWindow(CustomerValue,R.right/3,R.bottom/4,R.right/3.5,R.bottom/15,1);
  46.         MoveWindow(ButtonZlotowki,R.right/3,R.bottom/2.5+10,R.right/8,R.bottom/15,1);
  47.         MoveWindow(EndingValue,R.right/2,R.bottom/2.5+10,R.right/8,R.bottom/15,1);
  48.     }break;
  49.  
  50.     case WM_GETMINMAXINFO:
  51.         ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 500;
  52.         ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 400;
  53.         ((MINMAXINFO*)lParam)->ptMaxTrackSize.x = 1000;
  54.         ((MINMAXINFO*)lParam)->ptMaxTrackSize.y = 900;
  55.         break;
  56.  
  57.     case WM_COMMAND:
  58.        
  59.         switch(LOWORD(wParam)){
  60.         case ID_BUTTONEURO:
  61.             switch(HIWORD(wParam)){
  62.             case BN_CLICKED:
  63.                 if(SendDlgItemMessage(hwnd,ID_BUTTONEURO,BM_GETCHECK,0,0)==0){  
  64.                 SendDlgItemMessage(hwnd,ID_BUTTONEURO,BM_SETCHECK,1,0);
  65.                 SendDlgItemMessage(hwnd,ID_BUTTONFUNTY,BM_SETCHECK,0,0);
  66.                 }
  67.  
  68.                 break;
  69.             }
  70.             break;
  71.         case ID_BUTTONFUNTY:
  72.             switch(HIWORD(wParam)){
  73.             case BN_CLICKED:
  74.                 if(SendDlgItemMessage(hwnd,ID_BUTTONFUNTY,BM_GETCHECK,0,0)==0){  
  75.                 SendDlgItemMessage(hwnd,ID_BUTTONFUNTY,BM_SETCHECK,1,0);
  76.                 SendDlgItemMessage(hwnd,ID_BUTTONEURO,BM_SETCHECK,0,0);
  77.                 }
  78.                 break;
  79.  
  80.             }
  81.         case ID_CUSTOMERVALUE:
  82.            
  83.             break;
  84.         case ID_BUTTONZLOTOWKI:
  85.             switch(HIWORD(wParam)){
  86.             case BN_CLICKED:
  87.                 if(SendDlgItemMessage(hwnd,ID_BUTTONFUNTY,BM_GETCHECK,0,0)==0){SetWindowText(EndingValue,"Euro");}
  88.                 else{SetWindowText(EndingValue,"Funty");}
  89.                 break;
  90.            
  91.             }
  92.  
  93.             break;
  94.        
  95.         }
  96.  
  97.         break;
  98.  
  99.     case WM_CLOSE:
  100.         DestroyWindow(hwnd);
  101.         break;
  102.  
  103.     case WM_DESTROY:
  104.     {
  105.    
  106.         PostQuitMessage(0);
  107.     }break;
  108.  
  109.     default:
  110.         return DefWindowProc(hwnd, msg, wParam, lParam);
  111.     }
  112.     return 0;
  113. }
  114.  
  115. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  116. {
  117.     WNDCLASSEX wc;
  118.     wc.cbSize = sizeof(WNDCLASSEX);
  119.     wc.style = 0;
  120.     wc.cbClsExtra = 0;
  121.     wc.cbWndExtra = 0;
  122.     wc.hInstance = hInstance;
  123.     wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
  124.     wc.lpfnWndProc = WndProc;
  125.     wc.lpszClassName = className;
  126.     wc.lpszMenuName = NULL;
  127.     wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  128.     wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  129.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  130.  
  131.     if (RegisterClassEx(&wc) == 0)
  132.     {
  133.         MessageBox(NULL, TEXT("wc"), className, MB_OK);
  134.         return 1;
  135.     }
  136.  
  137.     hwnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_CLIENTEDGE, className, appName, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH, SCREEN_HEIGHT,0, 0, hInstance, 0);
  138.     if (hwnd == NULL)
  139.     {
  140.         MessageBox(NULL, TEXT("hwnd"), className, MB_OK);
  141.         return 1;
  142.     }
  143.  
  144.     ShowWindow(hwnd, nCmdShow);
  145.     UpdateWindow(hwnd);
  146.  
  147.     while (GetMessage(&msg, NULL, 0, 0) > 0)
  148.     {
  149.         TranslateMessage(&msg);
  150.         DispatchMessage(&msg);
  151.     }
  152.  
  153.     UnregisterClass(className, hInstance);
  154.  
  155.     return msg.wParam;
  156. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top