TRUESPACE - INPUT DEVICES

ActiveX Input Devices

This page has 2 activex dll files that can be used with microsoft scripting technologies to read a 3DConnexion Space Navigator and a directX joystick.  The C++ source code for the activex files are also available on this page.  Below that shows sample jscript listing of the demo objects, to see how the dll's can be used in other applications.

The first thing is to register the dll files so that the script and windows know it's available for use.  After the dll's are registered just drag the object into the link editor to start using it.

spacenavjoystick demo

Both objects are used in the same way.  Load the object, press start and check the checkbox.  When you are done push stop.  The start button initializes and connects to the device.  The checkbox activates the timer that updates the display values.  The stop button will free the device.

The zip files contain both the dll file and the truespace demo script object.  The dll file needs to be registered with windows using the regsvr32 command which can be executed from start-run or from accessories-command prompt.

If I saved the dll files to

then the command to register them would be

after which windows either says all is good or not

 

click this line to get the Space Navigator demo and dll files

click this line to get the Joystick demo and dll files

click this line for the Space Navigator dll c++ source files

click this line for the Joystick dll c++ source files

link to microsoft page for creating com server(activex) - the one change I make is that when adding a property I only check "Get" or "Put". Having both checked gave me problems when trying to use the activex with scripting.

// SpaceNavigator Demo Program
// October 21 2007
// Clinton Reese(clintonman)
//
// Uses activex object written in C++ - ActiveXObject("My3DConnServer.Object1")
// InitNav() initializes Space Navigator device
// FreeNav() cleanup and free the device
//
//
// Execute
//
//
// STDMETHOD(get_InitNav)(SHORT* pVal);
// STDMETHOD(get_FreeNav)(SHORT* pVal);
// STDMETHOD(get_Button1)(SHORT* pVal);
// STDMETHOD(get_Button2)(SHORT* pVal);
// STDMETHOD(get_AX)(DOUBLE* pVal);
// STDMETHOD(get_AY)(DOUBLE* pVal);
// STDMETHOD(get_AZ)(DOUBLE* pVal);
// STDMETHOD(get_X)(DOUBLE* pVal);
// STDMETHOD(get_Y)(DOUBLE* pVal);
// STDMETHOD(get_Z)(DOUBLE* pVal);
//
//
// Called to execute the command
function Execute(params)
{

// TODO: put your action code here
var JObj;
JObj = new ActiveXObject("My3DConnServer.Object1");

//translation
params.ConValue("x") = JObj.X();
params.ConValue("y") = JObj.Y();
params.ConValue("z") = JObj.Z();

//angle
params.ConValue("rx") = JObj.AX();
params.ConValue("ry") = JObj.AY();
params.ConValue("rz") = JObj.AZ();

//buttons
params.ConValue("button1") = JObj.Button1();
params.ConValue("button2") = JObj.Button2();

}

 

 

// Joystick Demo Program
// October 21 2007
// Clinton Reese(clintonman)
//
// Uses activex object written in C++ - ActiveXObject("MyJoystickServer.Object1")
// InitJoy() initializes the directx input for the joystick - it only retrieves the first joystick found
// FreeJoy() cleanup and free the joystick
// buttons are read by first choosing a button
// SetButton(0) will choose the first button
// then reading the value
// GetButton()
//
//
// Execute
//
//
// STDMETHOD(get_GetX)(LONG* pVal);
// STDMETHOD(get_InitJoy)(SHORT* pVal);
// STDMETHOD(get_FreeJoy)(SHORT* pVal);
// STDMETHOD(get_GetY)(LONG* pVal);
// STDMETHOD(get_GetZ)(LONG* pVal);
// STDMETHOD(get_GetRX)(LONG* pVal);
// STDMETHOD(get_GetRY)(LONG* pVal);
// STDMETHOD(get_GetRZ)(LONG* pVal);
// STDMETHOD(get_GetSlider1)(LONG* pVal);
// STDMETHOD(get_GetSlider2)(LONG* pVal);
// STDMETHOD(get_GetPOV1)(SHORT* pVal);
// STDMETHOD(get_GetPOV2)(SHORT* pVal);
// STDMETHOD(get_GetPOV3)(SHORT* pVal);
// STDMETHOD(get_GetPOV4)(SHORT* pVal);
// STDMETHOD(get_GetButton)(BYTE* pVal);
// STDMETHOD(put_SetButton)(BYTE newVal);
//
//
// Called to execute the command
function Execute(params)
{

// TODO: put your action code here
var JObj;
JObj = new ActiveXObject("MyJoystickServer.Object1");

//translation
params.ConValue("x") = JObj.GetX();
params.ConValue("y") = JObj.GetY();
params.ConValue("z") = JObj.GetZ();

//rotation
params.ConValue("rx") = JObj.GetRX();
params.ConValue("ry") = JObj.GetRY();
params.ConValue("rz") = JObj.GetRZ();

//sliders
params.ConValue("slider") = JObj.GetSlider1();
params.ConValue("slider2") = JObj.GetSlider2();

//pov
params.ConValue("pov1") = JObj.GetPOV1();
params.ConValue("pov2") = JObj.GetPOV2();
params.ConValue("pov3") = JObj.GetPOV3();
params.ConValue("pov4") = JObj.GetPOV4();

//buttons
JObj.SetButton(0);
params.ConValue("button1") = JObj.GetButton();
JObj.SetButton(1);
params.ConValue("button2") = JObj.GetButton();
JObj.SetButton(2);
params.ConValue("button3") = JObj.GetButton();
JObj.SetButton(3);
params.ConValue("button4") = JObj.GetButton();
JObj.SetButton(4);
params.ConValue("button5") = JObj.GetButton();
JObj.SetButton(5);
params.ConValue("button6") = JObj.GetButton();
JObj.SetButton(6);
params.ConValue("button7") = JObj.GetButton();
JObj.SetButton(7);
params.ConValue("button8") = JObj.GetButton();


}