Transparent Window with Clickthrough and on Top

56 Views Asked by At

I am currently working on a small overlay project in Game Maker that I want to always render on top, have a transparent background, and allow clickthrough to the window behind it. Using GML extensions and a DLL has worked for the transparent background part, although nothing I have tried for the rest have worked.

Using SetWindowPos for HWND_TOPMOST or calling it with HWND_TOP every time it get minimized has seemingly no effect. This thread seems to be close to what I am looking for, except I do not need the DirectX rendering as Game Maker should do that for me, and I do not think it will connect with the GML extension that I need it to.

#include "pch.h"
#include <dwmapi.h>
//[DllImport("User32.dll")]
//#include <User32.dll>

extern "C" __declspec(dllexport) void DLLMakeWindowTransparent2(HWND hwnd) {
    //get HWND from Gamemaker
    //makes the background of the gamemaker window transparent, this works fantastically
    MARGINS margins = { -1,0,0,0 }; 
    DwmExtendFrameIntoClientArea(hwnd, &margins);

}
extern "C" __declspec(dllexport) void DLLMakeWindowTop(HWND hwnd) {
    //should force the window to always display on top, but hasnt worked
    //SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
0

There are 0 best solutions below