How to prevent crash if the driver isn't installed

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

Moderator: Moderators

Post Reply
Jesperk
Posts: 2
Joined: Mon Jun 09, 2008 12:42 am

How to prevent crash if the driver isn't installed

Post by Jesperk »

I'm adding 3D nagivation to our application in VS2005 C#. I find that my program crashes on machines that doesn't have the driver installed.

I distribute the TDx.TDxInput.dll with my application, but what happends if the 3DxWare isn't installed?

Should I also distribute the TDxInput.dll? And should I register it as a COM object?

I do this in my Camera constructor (and it crashes with a COM exception on other machines than my own):

m_tdxDevice = new TDx.TDxInput.Device();
m_tdxSensor = m_tdxDevice.Sensor;
m_tdxKeyboard = m_tdxDevice.Keyboard;
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi Jesperk,

You need to put a try {} catch around the new TDx.TDxInput.Device() call. You will get a COMException if the driver is not installed. Don't make any other calls in this case.

If the driver is installed but not running, you can make the calls on the TDx object. You just won't get any events until you install a device.

I've put an example on our ftp site:

ftp:/ *** ***
login: ***
password: ***



Moderator Edit: the sample code is no longer available from the FTP service. Please contact 3Dconnexion API Support if you need further assistance.
Post Reply