We help IT Professionals succeed at work.

how do i get a tool tip on a IVideoWindow video capture preview overlay?

So I have a MFC CDialog with a video preview of a webcam running in it.  There's a static window in the dialog that I use to parent the IVideoWindow to, via put_Owner.  The dialog has tips enabled via EnableToolTips() using a CToolTipCtrl member in the dialog.  Other static elements in the dialog have tips correctly via AddTool.  So the problem is, using AddTool for the static window that's the parent of IVideoWindow doesn't help, because IVideoWindow ends up being on top of it.  I found some code that supposedly let me get the HWND of the IVideoWindow, but that failed to find the pin.  Anyone figured out how to get a tip on the video preview overlay?
Comment
Watch Question

Commented:
>> "There's a static window in the dialog that I use to parent the IVideoWindow to, via put_Owner."

Does the static window have the SS_NOTIFY style set??

Author

Commented:
Thanks, yes, it does have SS_NOTIFY set... which works until the iVideoWindow overlays the static with its own window then the notify doesn't get triggered.  Presumably buried deep in COM is another HWND which I don't know how to access.

Commented:
OK, can you not forward the relevant mouse messages directly to the static control underneath?  

Author

Commented:
Interesting suggestion... trying to think of how I'd do that... presumably the COM-hidden HWND is getting the messages, not sure if/how I could subclass that HWND to get them without access... I'd probably have to get them from the main message loop; boy would that be ugly, but do-able.  Or are you thinking of another mechanism?

Commented:
If you can be sure that the required messages are going to the COM hidden HWND, then you could subclass the window by replacing its WNDPROC with your own custom on (the old SetWindowLong/GetWindowLong trick - http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx - see GWL_WNDPROC).  You forward tooltip related messages onto the static control (which you can pass the HWND of to your custom WNDPROC), otherwise you forward the messages to the original WNDPROC (which you again pass - bundle everything up in a nice structure).

Given, this is quite complicated.

Alternatively, and possibly more simply, track the position of the mouse manually; when it is over your video control, forcibly display the tooltip.

Author

Commented:
I'd be ok with subclassing the HWND, but I don't have access to it, i.e. don't know the HWND value, I'm just assuming there's a window there... so finding it is one issue.  Regarding tracking the mouse manually, since my static control (that's overlayed) doesn't get window messages, I suppose I'd have to track them, how, globally via a hook?  I may be punting on this feature... ugh...
Commented:
Your video control is embedded in a dialog, right?  Track the mouse movements in the dialog.  You know the rectangle of the video, so assuming the dialog still receives the mouse movements when they are over the video, if the co-ordinates are in the video's rectangle then force display of tooltip.

PS http://www.codeguru.com/cpp/g-m/directx/directshow/article.php/c4355/Moving-a-Video-Window-Video-Renderer-Filter-by-Using-the-Mouse.htm shows how to get the HWND of the video control.  It might be useful for you.

Author

Commented:
Thanks again, yeah I tried using that solution you mentioned but the FindPin method was failing on me so I had no Overlay interface for getting the handle.  I may look to see if mouse messages are propagating to the dialog... thanks again.  Or maybe I'll go the probably much more inefficient route and get rid of the automatic IVideoWindow preview and just grab and display the data the old fashioned way... that would solve a resize flicker issue as well...

Commented:
No problem.  Feel free to close the question or leave it open as you see fit.

Commented:
Hi, in the interest of keeping the zones tidy, can you please close this question, or, if you need more help, please clarify and I will be glad to assist.

Thanks.

Author

Commented:
gave up implementing this

Explore More ContentExplore courses, solutions, and other research materials related to this topic.