Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- HWND windowHandle;
- LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- {
- switch (msg)
- {
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
- }
- }
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
- {
- WNDCLASSEX wc;
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.cbClsExtra = NULL;
- wc.cbWndExtra = NULL;
- wc.hIconSm = NULL;
- wc.hInstance = hInstance;
- wc.lpfnWndProc = WndProc;
- wc.style = CS_HREDRAW | CS_VREDRAW,
- wc.lpszClassName = "Breeze";
- wc.lpszMenuName = NULL,
- wc.hCursor = LoadCursor(0, IDC_ARROW),
- wc.hIcon = LoadIcon(0, IDI_APPLICATION),
- wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- RegisterClassEx(&wc);
- windowHandle = CreateWindowEx(WS_EX_ACCEPTFILES, "Breeze", "Breeze Test",
- WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 800, 600, 0, 0, hInstance, 0);
- if (windowHandle == NULL)
- {
- MessageBoxA(0, "Failed to load", "Error", 0);
- }
- ShowWindow(windowHandle, showCmd);
- UpdateWindow(windowHandle);
- MSG msg;
- SecureZeroMemory(&msg, sizeof(MSG));
- int returnValue = NULL;
- while ((returnValue = GetMessage(&msg, 0, 0, 0)) != NULL)
- {
- if (returnValue == 1)
- {
- MessageBoxA(windowHandle, "GetMessage Failed", "Error", 0);
- break;
- }
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- return (int)msg.wParam;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement