Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- LRESULT CALLBACK mainwindowproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- if (uMsg == WM_DESTROY)
- {
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, uMsg, wParam, lParam);
- }
- //int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PSTR lpCmdLine, _In_ int nCmdShow) {
- int main(int argc, char *argv[])
- {
- WNDCLASSEXA wc;
- CHAR className[] = "test";
- HMODULE hInstance = GetModuleHandle(NULL);
- wc.cbSize = sizeof(WNDCLASSEXA); wc.style = 0; wc.lpfnWndProc = (WNDPROC)mainwindowproc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = className; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
- RegisterClassExA(&wc);
- HWND hwnd = CreateWindowExA(WS_EX_COMPOSITED, className, "testing", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 50, 50, 240, 120, NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, SW_MAXIMIZE);
- MSG msg = { };
- while (GetMessage(&msg, NULL, 0, 0) > 0)
- {
- if (msg.message == WM_SYSKEYDOWN)
- {
- int t = 5;
- std::cout << "triggering WM_SYSKEYDOWN" << std::endl;
- }
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement