1 か月前 · Jul 22, 2026 9:33 AM
Create a top-level transparent overlay window that passes mouse clicks straight to the game:
CPP
HWND CreateOverlayWindow(HINSTANCE hInstance, int width, int height) {
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW, WndProc, 0, 0, hInstance, NULL, NULL, NULL, NULL, "OverlayClass", NULL };
RegisterClassEx(&wc);
HWND hWnd = CreateWindowEx(
WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE,
"OverlayClass", "Overlay", WS_POPUP, 0, 0, width, height, NULL, NULL, hInstance, NULL
);
SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 0, LWA_COLORKEY);
MARGINS margins = { -1, -1, -1, -1 };
DwmExtendFrameIntoClientArea(hWnd, &margins);
ShowWindow(hWnd, SW_SHOW);
return hWnd;
}DwmExtendFrameIntoClientArea hardware-blends transparency via DWM compositor with zero flicker!