Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- // WinMain: The Application Entry Point
- int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR nCmdLine, int nCmdShow)
- {
- // Register the window class
- const wchar_t CLASS_NAME[] = L"WindowClass";
- WNDCLASS wc = { };
- wc.lpfnWndProc = WindowProc;
- wc.lpszClassName = CLASS_NAME;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- RegisterClass(&wc);
- // Create the window
- HWND hwnd = CreateWindowEx(
- 0,
- CLASS_NAME,
- L"EYELINE",
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
- NULL,NULL,hInstance,NULL);
- if(hwnd == 0)
- return 0;
- // Show the window
- ShowWindow(hwnd, nCmdShow);
- nCmdShow = 1;
- ShowCursor(FALSE);
- BOOL WINAPI BringWindowToTop(_In_ HWND hWnd);
- LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
- lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU | WS_EX_TOPMOST | SWP_NOMOVE | SWP_NOSIZE);
- SetWindowLong(hwnd, GWL_STYLE, lStyle);
- SetWindowPos(hwnd, HWND_TOPMOST, 0,0,1920,1080, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
- SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
- // The Message loop
- MSG msg = { };
- while(GetMessage(&msg,NULL,0,0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return 0;
- }
- // Window Procedure function
- LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- switch(uMsg)
- {
- case WM_DESTROY:PostQuitMessage(0); return 0;
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwnd,&ps);
- FillRect(hdc,&ps.rcPaint,(HBRUSH)(COLOR_WINDOW+5));
- EndPaint(hwnd,&ps);
- }return 0;
- case WM_CLOSE:
- {
- if(MessageBox(hwnd,L"Do you want to exit?",L"EXIT",MB_OKCANCEL)==IDOK)
- DestroyWindow(hwnd);
- }return 0;
- }
- return DefWindowProc(hwnd,uMsg,wParam,lParam); // Default Message Handling
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement