Skip to content

Instantly share code, notes, and snippets.

@ske2004
Last active May 14, 2025 13:20
Show Gist options
  • Save ske2004/9d5ad81bbd722c5161cc79c927f49974 to your computer and use it in GitHub Desktop.
Save ske2004/9d5ad81bbd722c5161cc79c927f49974 to your computer and use it in GitHub Desktop.
Just shows a fullscreen white color, press ESC to exit, I use it to wipe my screen :P
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "gdi32.lib")
#include <Windows.h>
LRESULT CALLBACK WndProc(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
)
{
switch (Msg) {
case WM_KEYDOWN:
if (wParam == VK_ESCAPE) {
PostQuitMessage(0);
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
int APIENTRY WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASSA WindowClass = { 0 };
WindowClass.lpszClassName = "Blank";
WindowClass.lpfnWndProc = WndProc;
WindowClass.hbrBackground = CreateSolidBrush(RGB(255, 255, 255));
RegisterClassA(&WindowClass);
HWND Window = CreateWindowA(
WindowClass.lpszClassName,
"Blank",
WS_POPUP | WS_VISIBLE,
0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(Window, nCmdShow);
MSG Msg = { 0 };
while (GetMessageA(&Msg, NULL, 0, 0)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment