#include <windows.h>
#define MYCLASSNAME ("__someclassname__") LRESULT CALLBACK WinProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch (Msg) { case WM_LBUTTONDOWN: MessageBox(NULL, "Left button is down!", NULL, MB_OK); break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, Msg, wParam, lParam); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCommandLine, int nShowCmd) { MSG msg; WNDCLASS wc = {0}; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); wc.lpszClassName = MYCLASSNAME; wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)); wc.hInstance = hInstance; wc.lpfnWndProc = WinProc; RegisterClass(&wc);
HWND hWnd = CreateWindow(MYCLASSNAME, "FullScreenWnd", WS_POPUP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_TOPMOST); ShowWindow(hWnd, nShowCmd); UpdateWindow(hWnd);
BOOL bRet; while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { if (bRet == -1) break; else { TranslateMessage(&msg); DispatchMessage(&msg); } } return -1; } |