With an ActiveX control in an browser window container, how do I detect when user changes tab away from activex control

StackOverflow https://stackoverflow.com/questions/2338071

Question

I have an ActiveX control that gets placed in an IE browser container. The control creates another dialog window that has WS_POPUP and WS_LAYERED properties enabled in order to be able to use SetLayeredWindowAttributes(...) function to accomplish color keyed transparency and alpha blending on top of the control.

Because the WS_LAYERED property cannot be used in conjunction with WS_CHILD property the management of the window visibility is not automatic. I need to be able to detect when the ActiveX control is no longer visible (i.e. because the browser tab was changed or minimized) so I can change the visibility of the overlay window.

I have tried to use some of the existing window messages (WM_) to determine this change but have not seen them fire when the IE browser tab is changed. Does anyone know the best way to capture when these visibility changes are happening?

Was it helpful?

Solution

If you aren't seeing a WM_SHOWWINDOW notification, then your window is being covered over rather than hidden. There is no Windows message that will tell you when your ActiveX control has been covered over. You need to look for notifications from the browser.

Or come up with a solution that doesn't use a WS_POPUP window. Perhaps you could use AlphaBlend to do your own color keying rather than relying on the implied AlphaBlend behavior of SetLayeredWindowAttributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top