spaceMouse Plus and QT on Windows

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

Moderator: Moderators

Post Reply
Vincent9263
Posts: 4
Joined: Fri Mar 07, 2008 1:53 am

spaceMouse Plus and QT on Windows

Post by Vincent9263 »

Hello,

I would like to use my spaceMouse plus with Qt but I have problem with the "SiOpen" function. In fact, this function asks the "Application name" but with Qt there isn't an AppName. Is there anybody who could help me?
Thanks
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

The application name argument is rather arbitrary. It should match what you include in your config file, but it isn't necessary. Your problem with Qt is probably going to be to provide a valid hwnd, and to break into the event loop to find out when you have received an event. There have been others that have made this work. Please post the essentials of your solution here if you get it to work.
Vincent9263
Posts: 4
Joined: Fri Mar 07, 2008 1:53 am

Post by Vincent9263 »

Hello,

In fact, it looks to work with the "virtual bool winEventFilter( MSG * m, long * l)" function.

The problem is that the event which identifies the mouse movement comes from m->wParam and this changes every times you launch your application.

Do you have an idea to identifie the event?

Thanks
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

SiGetEvent will determine whether the windows event is from the 3Dx device. You pass all windows messages to it and it filters out the 3DxWare events. It uses a registered windows message. The online C/C++ SDK doc demostrates how to look up this value.
Vincent9263
Posts: 4
Joined: Fri Mar 07, 2008 1:53 am

Post by Vincent9263 »

Hello,
I have used the "winEventFilter(MSG *, long *)' function because i couldn't use the "SiGetEvent (SiHdl hdl, int flags, SiGetEventData *pData, SiSpwEvent *pEvent)" function.
The problem comes from the "hdl" parameter because this the "ApplicationName". This is easy if you use the MFC because you define the "ApplicationName" but with Qt it looks impossible to get this "ApplicationName" (Window handle) because you don't define it.
Thanks
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

I don't know if we are talking about the same things here.

The ApplicationName (pAppName) that is passed into the SiOpen function is a completely arbitrary string. You can make it anything you want.

The hWnd that is passed in to SiOpenWinInit has to be a hdl to a window somewhere in your process. This is the window where the 3Dx events are sent. You have to be able to get notified of events that appear on that hdl (or are propogated around from that hwnd). This would normally be the main window of the app.

Normally these frameworks have a way to get the hwnd of the main window. Something like QtMainWindow.

You can make your own window with Win32 functions and assign your own WndProc to it to get events. The window doesn't necessarily have to be displayed or get focus. It just has to be owned by your process.

Jim
3Dx Software Development
Post Reply