Developer knowledge network · moderated exchange

Zajednica UnreliableCode

Zajednica za istraživanje, obrnuti inženjering i programiranje programera

Knowledge indexŽivjeti
4Categories
919Threads
2.8KPostovi
Tutorial

Zero-Flicker Transparent Click-Through Overlay Window with WS_EX_LAYERED [v2.4 Technical Discussion]

overlay_ninja
Member
MEMBER
Rep: 162
Datum pridruživanja: Mar 2022
Postovi: 2
Hvala: 76
3 prije tjedana · Jul 28, 2026 6:16 AM
#1

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!

imgui_artisan
UI Designer
MEMBER
Rep: 202
Datum pridruživanja: Apr 2019
Postovi: 54
Hvala: 28
3 prije tjedana · Jul 28, 2026 11:09 AM
#2

WS_EX_TRANSPARENT | WS_EX_NOACTIVATE ensures the game retains 100% keyboard and mouse focus without window flashing.

ptr_arithmetic
C++ Wizard
MEMBER
Rep: 162
Datum pridruživanja: May 2018
Postovi: 73
Hvala: 42
3 prije tjedana · Jul 28, 2026 5:33 PM
#3

Clean DWM window setup.