1
votes

I'm using the following code to make my form entirely transparent so that clicks can go "through" it to other windows.

SetWindowPos( handle, HWND_TOPMOST, 0, 0, 0,0,
                   SWP_NOSIZE or SWP_NOMOVE );
SetWindowLong(form1.handle,GWL_EXSTYLE,WS_EX_TOPMOST or WS_EX_LAYERED);
SetLayeredWindowAttributes(form1.handle,RGB(0,0,0),200,LWA_ALPHA or LWA_COLORKEY);

My problem is that when I begin drawing on the form, these drawings can be clicked on and the Delphi form will take focus. I want to be able to draw without these drawings being "clickable".

I hope I was clear enough. Any help is appreciated.

2

2 Answers

1
votes

You need to set the WS_EX_TRANSPARENT extended window style too.

1
votes

Either give your window the WS_EX_TRANSPARENT window style, or handle the WM_NCHITTEST message and return HTTRANSPARENT. see this related post for an example (Windows API) WM_PAINT Mouse problems