Adobe Air with WS_EX_LAYERED window style

安稳与你 提交于 2020-03-03 12:26:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!