Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <Windows.h>
  2.  
  3. HWND windowHandle;
  4.  
  5. LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  6. {
  7. switch (msg)
  8. {
  9. case WM_CLOSE:
  10. DestroyWindow(hwnd);
  11. break;
  12. case WM_DESTROY:
  13. PostQuitMessage(0);
  14. break;
  15. default:
  16. return DefWindowProc(hwnd, msg, wParam, lParam);
  17. }
  18. }
  19.  
  20. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
  21. {
  22. WNDCLASSEX wc;
  23.  
  24. wc.cbSize = sizeof(WNDCLASSEX);
  25. wc.cbClsExtra = NULL;
  26. wc.cbWndExtra = NULL;
  27. wc.hIconSm = NULL;
  28.  
  29. wc.hInstance = hInstance;
  30. wc.lpfnWndProc = WndProc;
  31. wc.style = CS_HREDRAW | CS_VREDRAW,
  32. wc.lpszClassName = "Breeze";
  33. wc.lpszMenuName = NULL,
  34. wc.hCursor = LoadCursor(0, IDC_ARROW),
  35. wc.hIcon = LoadIcon(0, IDI_APPLICATION),
  36. wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
  37. RegisterClassEx(&wc);
  38.  
  39. windowHandle = CreateWindowEx(WS_EX_ACCEPTFILES, "Breeze", "Breeze Test",
  40. WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 800, 600, 0, 0, hInstance, 0);
  41.  
  42. if (windowHandle == NULL)
  43. {
  44. MessageBoxA(0, "Failed to load", "Error", 0);
  45. }
  46.  
  47. ShowWindow(windowHandle, showCmd);
  48.  
  49. UpdateWindow(windowHandle);
  50.  
  51. MSG msg;
  52.  
  53. SecureZeroMemory(&msg, sizeof(MSG));
  54.  
  55. int returnValue = NULL;
  56. while ((returnValue = GetMessage(&msg, 0, 0, 0)) != NULL)
  57. {
  58. if (returnValue == 1)
  59. {
  60. MessageBoxA(windowHandle, "GetMessage Failed", "Error", 0);
  61. break;
  62. }
  63.  
  64. TranslateMessage(&msg);
  65. DispatchMessage(&msg);
  66.  
  67. return (int)msg.wParam;
  68. }
  69.  
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement