Checking focus of an ActiveX control's view

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Checking focus of an ActiveX control's view

Mikael Svane-2
I have a visual ActiveX control that I have subclassed from AXControlSite.
When the control's view is opened, the control itself opens another window.
Is it possible somehow to see if this other window has focus or is in the
foreground? I have tried #hasFocus, #hasFocusDeeply, #isActive and
#isForeground but - as expected - none of them can be used in this case. Is
there another possibility or should I give up?

Best regards,

Mikael Svane
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Checking focus of an ActiveX control's view

Blair McGlashan
"Mikael Svane" <[hidden email]> wrote in message
news:a5uam1$aa5fh$[hidden email]...
> I have a visual ActiveX control that I have subclassed from AXControlSite.
> When the control's view is opened, the control itself opens another
window.
> Is it possible somehow to see if this other window has focus or is in the
> foreground? I have tried #hasFocus, #hasFocusDeeply, #isActive and
> #isForeground but - as expected - none of them can be used in this case.
Is
> there another possibility or should I give up?

#hasFocusDeeply will find it if it is a true child of the control site,
regardless of whether it is a Dolphin window (Thinks: "Perhaps AXControlSite
should really override #hasFocus as #hasFocusDeeply since the actual control
will always be a child"). However if the OCX opens another top-level window
such that the AXControlSite is not on its parent chain, then I can't see a
way that you will be able to detect it unless the OCX provides a way to
access its subsidiary window's handle. If you can get at the handle, then
obviously you can subclass AXControlSite and test the handle for focus
explicitly in an override of #hasFocus.

Regards

Blair