Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <vector>
- using namespace std;
- vector<HWND> uchwyty;
- LRESULT CALLBACK Proces(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){
- switch(msg){
- case WM_CLOSE:{
- if(IDYES==MessageBox(0,L"Chcesz zamknac okno?",L"Alert",MB_YESNO)) DestroyWindow(hWnd);
- } break;
- case WM_DESTROY:{
- PostQuitMessage(0);
- } break;
- }
- return 0;
- }
- bool RejestrujKlase(WNDCLASSEX &okno, HINSTANCE hInst){
- okno.cbClsExtra = okno.cbWndExtra = 0;
- okno.cbSize = sizeof(WNDCLASSEX);
- okno.hbrBackground = (HBRUSH)(1+COLOR_WINDOW);
- okno.hCursor = LoadCursor(NULL,IDC_ARROW);
- okno.hIcon = okno.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
- okno.hInstance = hInst;
- okno.lpfnWndProc = Proces;
- okno.lpszClassName = L"OKNO";
- okno.lpszMenuName = 0;
- okno.style = 0;
- if(!RegisterClassEx(&okno)) return true;
- return false;
- }
- int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE AAA, LPWSTR lpCmdLine, int nShowCmd){
- WNDCLASSEX klasa;
- RejestrujKlase(klasa, hInst);
- MSG msg;
- uchwyty.push_back(CreateWindowEx(0,L"OKNO",L"TEST_1",WS_OVERLAPPEDWINDOW ^ WS_VISIBLE,30,30,400,300,0,0,GetModuleHandle(NULL),0));
- ShowWindow(uchwyty.back(),nShowCmd);
- UpdateWindow(uchwyty.back());
- while(1){GetMessage(&msg,0,0,0);
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- UnregisterClass(L"WINDOW",hInst);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement