Transparent window

Hi, I am trying to make a transparent window, so the objects in the scene will display on top of windows. Take a look at this: https://www.reddit.com/r/unrealengine/comments/8e8bib/question_fully_transparentclickthru_application/
This is how it looks if I use that code:


Anyone know how to fix this? Thankyou

1 Like

This works:



    const auto hwnd = GetActiveWindow();

    if (hwnd)
    {
        SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE);
        SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT);

        RECT rect;
        GetWindowRect(hwnd, &rect);
        SetWindowPos(hwnd, HWND_TOPMOST, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_SHOWWINDOW);

        const MARGINS margins{ -1 };
        DwmExtendFrameIntoClientArea(hwnd, &margins);
    }
    

Remove WS_EX_LAYERED if you don’t want click-through

1 Like

Thankyou very much!

Can you guide a bit upon where this should be done? Is it in unreal ? if yes then which file or classes needed to be modified ?

Hi, any idea why this works on windows 8 but doesn’t work on windows 11 ? I haven’t tried on windows 10.

Hi!
I want to test it in Windows 10 but can’t figure out which class should I manipulate. Is it the regular SWindow in Slate? Something else?

Thanks for any clues on the implementation!