views:

346

answers:

2

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.

A: 

This may not be possible, a lot of video output code makes use of hardware overlays so if your window is in front, the overlay either won't work, or won't draw where your pixels are at all.

Hardware overlays allow the video drawing code to present frames in a format other than that of the current display format, which can save a lot of CPU and memory bandwidth.

In my experience, the overlay is usually in YUV format rather than RGB because many video compression formats are based on YUV. So the video hardware is getting some pixels from a YUV image and NOT from the screen buffer, so you can't affect these pixels unless you get yourself inserted into the rendering code path of the video stream.

John Knoeller
I'm using a media (video) framework another development group in my company developed and am providing a window handle to that code. That handle is being used by their rendering plugin in the pipeline that uses Direct3d for rendering the video. A member of their UI group has other applications with a layer permanently on top of the video but they are using QT (cross-platform application and UI framework). They specified they are using Qt::FramelessWindowHint which produces a borderless window that always remains on top of the z order. If it can be done in Qt it should be possible in VC++.
flawlesslyfaulted
It's not a hardware overlay then, you can ignore this comment.
John Knoeller
A: 

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.

flawlesslyfaulted