use spacemouse classic serial on C#

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

Moderator: Moderators

Post Reply
Aigor
Posts: 3
Joined: Mon Apr 19, 2010 5:56 am

use spacemouse classic serial on C#

Post by Aigor »

hello,

I need to use the 3d mouse "SpaceMouse classic serial" in a C # application for windows xp.
I want to write a dll that can create an interface returning values read from the mouse, but all the examples I've found on your site use "SiOpenWinInit" which wants as second parameter  an HWND I don't have.

is there a way to solve this problem?

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

Post by jwick »

That device was discontinued so long ago there are no examples in C# for it. I extemely highly recommend picking up at least a SpaceNavigator for $100. It will save you a tremendous amount of time. We have lots of examples for USB devices.

If you need to use the serial device for some reason, you'll have to access the serial port yourself and parse the data format on your own. I have no idea how to do that in C#.
Aigor
Posts: 3
Joined: Mon Apr 19, 2010 5:56 am

Post by Aigor »

Even writing a module in C/C++ unmanaged, I can open the device without having a HWND?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

You need an HWND to use the Si API, but it doesn't have to be a displayed window. You can create a window w/o mapping it. You just need an event loop somewhere so the driver has someplace to send the messages from the device to your app. You can create an HWND even for a console app.

If you read the serial port, you don't need an HWND because you won't be using the driver.
Post Reply