Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2022
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. LRESULT CALLBACK mainwindowproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  5. {
  6. if (uMsg == WM_DESTROY)
  7. {
  8. PostQuitMessage(0);
  9. return 0;
  10. }
  11. return DefWindowProc(hwnd, uMsg, wParam, lParam);
  12. }
  13.  
  14. //int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ PSTR lpCmdLine, _In_ int nCmdShow) {
  15. int main(int argc, char *argv[])
  16. {
  17. WNDCLASSEXA wc;
  18. CHAR className[] = "test";
  19. HMODULE hInstance = GetModuleHandle(NULL);
  20. 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);
  21. wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = className; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  22. RegisterClassExA(&wc);
  23. HWND hwnd = CreateWindowExA(WS_EX_COMPOSITED, className, "testing", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 50, 50, 240, 120, NULL, NULL, hInstance, NULL);
  24. ShowWindow(hwnd, SW_MAXIMIZE);
  25. MSG msg = { };
  26. while (GetMessage(&msg, NULL, 0, 0) > 0)
  27. {
  28. if (msg.message == WM_SYSKEYDOWN)
  29. {
  30. int t = 5;
  31. std::cout << "triggering WM_SYSKEYDOWN" << std::endl;
  32. }
  33. TranslateMessage(&msg);
  34. DispatchMessage(&msg);
  35. }
  36. return 1;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement