WS_EX_LAYERED 与 SetParent() 不显示 window
WS_EX_LAYERED with SetParent() doesn't show the window
我有一个我无法解决的问题。我正在尝试从我的应用程序中创建一个透明的 window(使用标志 WS_EX_TRANSPARENT | WS_EX_LAYERED
)一个 child 到另一个不透明的 window。
当我不使用带有 WS_EX_LAYERED
标志的 my_window 的调用 SetParent( my_window, target_parent_window )
时,新的 child window 将不可见.
我发现清单条目可以帮助我,因为 child window 和标志 WS_EX_LAYERED
自从 Windows 8 以来就受到支持。我试过了没有任何成功。
::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
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 the CreateWindowEx
function, or call the SetWindowLong
function to set WS_EX_LAYERED
after the window has been created. After the CreateWindowEx
call, the layered window will not become visible until the SetLayeredWindowAttributes
or UpdateLayeredWindow
function has been called for this window.
我有一个我无法解决的问题。我正在尝试从我的应用程序中创建一个透明的 window(使用标志 WS_EX_TRANSPARENT | WS_EX_LAYERED
)一个 child 到另一个不透明的 window。
当我不使用带有 WS_EX_LAYERED
标志的 my_window 的调用 SetParent( my_window, target_parent_window )
时,新的 child window 将不可见.
我发现清单条目可以帮助我,因为 child window 和标志 WS_EX_LAYERED
自从 Windows 8 以来就受到支持。我试过了没有任何成功。
::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
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.