问题
I am trying to set the WS_EX_LAYERED extended window style on an external Adobe Air application. See this question if you want to know why. The problem I am facing is that as soon as I set the style, the window stops rendering. Here's the my code:
auto style = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED);
// If I skip the next line, the window is suddenly white.
// With the next line, the image in the window freezes.
SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
The window continues to work perfectly fine (clicks etc.), it just doesn't get redrawn anymore (f.e. when resized).
The window does not have the CS_OWNDC
or CS_CLASSDC
style.
Can anyone tell me what the reason could be?
回答1:
What's your render mode set to in the application descriptor file? I would imagine your approach wouldn't work unless you specifically set this to render via the CPU i.e. to make AIR use GDI functions to display the content. I think by default it's likely to be using GPU acceleration so setting the style via SetWindowLong may then interfere with this..
In case you're not sure how to change the render mode:
- Find the application's installed folder (under "Program Files (x86)")
- Enter the "META-INF\AIR" subfolder
- Edit the "application.xml" file
- Look for "renderMode" within the "initialWindow" section (or if it's not there, add it..) and set this to "cpu"
- Save this and then restart the AIR application
See AIR Descriptor File information.
来源:https://stackoverflow.com/questions/55836546/adobe-air-with-ws-ex-layered-window-style