Video and mouse events
Carsten A. Arnholm
arnholm at offline.no
Fri Sep 21 13:37:45 PDT 2007
Carsten A. Arnholm wrote:
> Hi,
>
> I am woring on a wxWidgets 2.8.4 webcam application that runs under
> Windows (XP) and Linux (Kubuntu 7.04). Using MS Visual Studio 2005
> Express compiler on XP and GCC on Kubuntu, both using Code::Blocks as
> IDE. This application also uses some platform dependent code for
> video rendering, i.e. DirectDraw on Windows and Video4Linux on Linux.
> Working well.
> I have started to make some event handlers for picking objects in the
> streaming video, i.e. essentially just wxEVT_LEFT_DOWN mouse event in
> the video area. The idea is to take the mouse coordinates and use
> that for real time processing of the info in the video frame.
>
> The mouse event works fine on both platforms as long as no video is
> streaming. When video is streaming, it doesn't work on Windows, only
> on Linux. So I guess DirectDraw is to blame somehow.
>
> I have tried to search around for clues, but I haven't really found
> any good leads, just lots of references to people who seem to have
> similar issues. Maybe someone here have seen the same problem and
> know how to enable mouse events for a window rendering DirectDraw
> graphics?
> Thanks for any help.
Well, there was no reply, but as I worked on this problem with someone else,
we found the solution. So I thought I would share it here. It is external to
wxWidgets really, but relevant to how wxWidgets can coexist/interoperate
with DirectDraw on Windows.
It turns out there is an IVideoWindow interface with a MessageDrain property
that can be set to the handle (HWND) of the video window, which again can be
obtained from the wxWidgets window using wxWindow::GetHandle().
<http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/directx_cpp/htm/messagedrainpropertyivideowindowobject.asp>
After setting this property, the wxWindows mouse events are now working
normally also when the DirectDraw video is streaming.
--
Carsten A. Arnholm
http://arnholm.org/
N59.776 E10.457
More information about the wx-users
mailing list