SpaceNavigator in NI Labwindows : Windows message number ?

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

Moderator: Moderators

Post Reply
Flat
Posts: 7
Joined: Wed Sep 07, 2011 1:08 am
Location: France

SpaceNavigator in NI Labwindows : Windows message number ?

Post by Flat »

Hi all,

I'm currently trying to integrate a SpaceNavigator 3D mouse in a NI Labwindows application for controlling a robot. Labwindows is an IDE using Ansi C as programming language.

So far, I've been able to handle the 3D mouse events trough the Windows messaging system (almost just as it is done in the 3DxTest.c demo that comes with the SDK).
The difference is that I can not go as deep as in 3DxTest in the message handling, since labwindows manages and handles Windows messages quite a lot, as indicated here:
http://digital.ni.com/public.nsf/allkb/ ... EF00839871

So I use a routine that intercepts only certain windows message, and the message must be given by its number. I made a small test to catch the 3Dx message number, and hardcode this number in the main program, and every thing works like a charm. So nice...

But the problem is that the message number delivered by the 3Dx devices seems to be varying... It depends on the session you're logged on, on the computer, etc... For instance, 3Dx devices message numbers are 49647 and 49486 on two different windows sessions...

So is there a simple way to get this windows message number programmatically during the 3Dx initialisation, or is there a workaraound that I may use...

Thanks a lot for any help.

François

P.S. I use Windows XP SP3 (32 bits)
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

It is a registered Windows message. You need to look it up each time the program starts. It will be consistent while your program is running.

There is some sample code in the html documentation that comes with the SDK that you can copy. Look for Code Samples -> MFC: RegisterWindowMessage.
Flat
Posts: 7
Joined: Wed Sep 07, 2011 1:08 am
Location: France

Post by Flat »

Hi Jim,

Thanks for the quick reply and for the hint.
I looked in the SDK doc, but missed this point as I don't use MFC :oops:

Anyway, it now works !
A simple call to RegisterWindowMessage("SpaceWareMessage00") after 3D mouse initialisation gives me the message number.

I haven't seen many LabWindows users 'round here, but if it may help, I will post here a code skeleton that I use to handle 3D mouses in LabWindows.

Many thanks again ! That's a great user support :D

François
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

That would be terrific if you would post a sample skeleton. Also if you could give the device a kind word on the LabWindows forums, that might bring people over.
Flat
Posts: 7
Joined: Wed Sep 07, 2011 1:08 am
Location: France

Post by Flat »

I can do both ;)

Just give me a week or two to throughout test all, and I'll be back.

Thx again,
François
Post Reply