Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. #include <windows.h>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. vector<HWND> uchwyty;
  7.  
  8. LRESULT CALLBACK Proces(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){
  9.     switch(msg){
  10.         case WM_CLOSE:{
  11.             if(IDYES==MessageBox(0,L"Chcesz zamknac okno?",L"Alert",MB_YESNO)) DestroyWindow(hWnd);
  12.                       } break;
  13.  
  14.         case WM_DESTROY:{
  15.             PostQuitMessage(0);
  16.                         } break;
  17.     }
  18.     return 0;
  19. }
  20.  
  21. bool RejestrujKlase(WNDCLASSEX &okno, HINSTANCE hInst){
  22.     okno.cbClsExtra =   okno.cbWndExtra =   0;
  23.     okno.cbSize =   sizeof(WNDCLASSEX);
  24.     okno.hbrBackground  =   (HBRUSH)(1+COLOR_WINDOW);
  25.     okno.hCursor    =   LoadCursor(NULL,IDC_ARROW);
  26.     okno.hIcon  =   okno.hIconSm    =   LoadIcon(NULL,IDI_APPLICATION);
  27.     okno.hInstance  =   hInst;
  28.     okno.lpfnWndProc    =   Proces;
  29.     okno.lpszClassName  =   L"OKNO";
  30.     okno.lpszMenuName   =   0;
  31.     okno.style  =   0;
  32.     if(!RegisterClassEx(&okno)) return true;
  33.     return false;
  34. }
  35.  
  36. int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE AAA, LPWSTR lpCmdLine, int nShowCmd){
  37.     WNDCLASSEX klasa;
  38.     RejestrujKlase(klasa, hInst);
  39.  
  40.     MSG msg;
  41.  
  42.     uchwyty.push_back(CreateWindowEx(0,L"OKNO",L"TEST_1",WS_OVERLAPPEDWINDOW ^ WS_VISIBLE,30,30,400,300,0,0,GetModuleHandle(NULL),0));
  43.  
  44.     ShowWindow(uchwyty.back(),nShowCmd);
  45.     UpdateWindow(uchwyty.back());
  46.  
  47.     while(1){GetMessage(&msg,0,0,0);
  48.         TranslateMessage(&msg);
  49.         DispatchMessage(&msg);
  50.     }
  51.  
  52.     UnregisterClass(L"WINDOW",hInst);
  53.     return 0;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement