Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Tutorial

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

overlay_ninja
Member
MEMBER
担当者: 162
参加日: Mar 2022
投稿: 2
ありがとう: 76
3 週間前 · 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
担当者: 202
参加日: Apr 2019
投稿: 54
ありがとう: 28
3 週間前 · 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
担当者: 162
参加日: May 2018
投稿: 73
ありがとう: 42
3 週間前 · Jul 28, 2026 5:33 PM
#3

Clean DWM window setup.