I have this one problem I just can't solve. I'm trying to make a window from my application that is transparent (using flags WS_EX_TRANSPARENT | WS_EX_LAYERED
) a child to another window, which is not transparent.
When I don't use the call SetParent( my_window, target_parent_window )
with my_window having the WS_EX_LAYERED
flag, the new child window won't be visible.
I found out that a manifest entry could help me, since having a child window with flag WS_EX_LAYERED
is supported since Windows 8. I tried it without any success.
::SetWindowLongW( process_window, GWL_STYLE, WS_CLIPSIBLINGS | WS_POPUP | WS_VISIBLE );
::SetWindowLongW( process_window, GWL_EXSTYLE, WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW );
::SetWindowPos( process_window, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
::ShowWindow( process_window, SW_SHOW );
::SetParent( process_window, new_parent_window); // if i skip this call the window will render perfectly
CodePudding user response:
https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features
To create a layered window, specify the
WS_EX_LAYERED
extended window style when calling theCreateWindowEx
function, or call theSetWindowLong
function to setWS_EX_LAYERED
after the window has been created. After theCreateWindowEx
call, the layered window will not become visible until theSetLayeredWindowAttributes
orUpdateLayeredWindow
function has been called for this window.