How can I overwrite the WndProc() using Qt under Windows?

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
Mathias
Posts: 11
Joined: Sat Sep 05, 2009 2:48 pm

How can I overwrite the WndProc() using Qt under Windows?

Post by Mathias »

Hey there

I'm using C++ with Visual Studio 2008. The app I'm working on was originally developed under Linux using Qt and there is also a Mac version both with SpaceNavigator support.

I'm now trying to include the SpaceNavigator under Windows with help of the file "Programming for the 3D Mouse.pdf" from the 3Dconnexion website. There I have code for registering the 3D Mouse for RawInput in section 9.1.1.
The following section 9.1.2 explains how to receive and process the input. My problem is, where to put this code?

I created a method

Code: Select all

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
       ...
}
but I don't know how to make the project call this method. Somehow I should overwrite the WndProc() method of my Qt window, but how can I do this?

Thanks a lot for help
Mathias
mbonk
Moderator
Moderator
Posts: 181
Joined: Mon Dec 04, 2006 4:06 am

Post by mbonk »

Hi Mathias,

If you want to overwrite the wndproc method, that is process window messages that are not processed by Qt then you might want to have a look at

bool QWidget::winEvent ( MSG * message, long * result )
bool QCoreApplication::winEventFilter ( MSG * msg, long * result )

Markus
Mathias
Posts: 11
Joined: Sat Sep 05, 2009 2:48 pm

Post by Mathias »

I could make it work using the setEventFilter() method. Thanks for help.
Post Reply