我有一個我無法解決的問題。我正在嘗試從我的應用程式中創建一個視窗,該視窗是透明的(使用 flags WS_EX_TRANSPARENT | WS_EX_LAYERED)到另一個不透明的視窗的子視窗。
當我不使用SetParent( my_window, target_parent_window )帶有WS_EX_LAYERED標志的my_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
uj5u.com熱心網友回復:
https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features
要創建分層視窗,請
WS_EX_LAYERED在呼叫CreateWindowEx函式時指定擴展視窗樣式,或者在創建視窗后呼叫SetWindowLong函式進行設定WS_EX_LAYERED。在之后CreateWindowEx的呼叫,直到分層的視窗不會變得可見SetLayeredWindowAttributes或UpdateLayeredWindow函式被呼叫此視窗。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/344026.html
