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;
How to prevent crash if the driver isn't installed
Moderator: Moderators
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.
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.