Search code examples
windowsactivextransparentz-orderlayered

How do I get a transparent windows dialog and drawing primitives to remain on top of a window that is drawing streaming video?


I have an activeX control that contains one window that has streaming video being drawn to it. I have a separate dialog that I create in another window that I have made transparent or semi-transparent in various ways (i.e. using the SetLayeredWindowAttributes(...) along with the Layered property [for alpha blending] of the dialog or setting the transparent property).

Additionally I've tried to use various methods to attempt to get the window for the dialog to always draw on top of the streaming video window but none have proved to work for me. If I have a button on the dialog or draw on the transparent surface with LineTo(...) calls they don't remain on top of the video. I have tried to use SetWindowPos to affect the z-order of the two windows and also tried to change the dialog window properties such as "TopMost" but with no avail.

Has anyone tried to do something like this for an overlaid window over streaming video and gotten the z-ordering to work at painting the front window always after the streaming video?

UPDATE: 02/10/10 - tried using WS_EX_LAYERED property with SetLayeredWindowAttributes(...) using LWA_COLORKEY and achieved what I was looking for. Since layered property cannot be used with WS_CHILD style this solution brings with it some required management of the overlay window position with respect to the window with video. Additionally there are some other oddities I am trying to eliminate. For instance, when activeX control window with video is embedded in an IE tab and I switch to another tab controls on the overlay window remain on top the new tab (when WS_POPUP style used). Still investigating if there will be alternative means of dealing with this other then determining the switch and hiding the window visability.


Solution

  • WS_EX_LAYERED property with SetLayeredWindowAttributes(...) using LWA_COLORKEY will achieve transparency where colorkey is used. Transpaerent overlay remains in front of video and active streaming video remains live. WS_CHILD style cannot be used with layered style and therefore window position requires additional management if WS_POPUP is used. Additional issues may arise from inability to have overlay as a child window. -see Q update.