public TesterForm() { InitializeComponent(); joystick = new vJoy(); position = new vJoy.JoystickState(); ///// General driver data short iVer = joystick.GetvJoyVersion(); bool enabled = joystick.vJoyEnabled(); string Prd = joystick.GetvJoyProductString(); string Mnf = joystick.GetvJoyManufacturerString(); string Srl = joystick.GetvJoySerialNumberString(); string prt = String.Format("Product: {0}; Version {1:X}; Manuf: {2}; Serial:{3}", Prd, iVer, Mnf, Srl); label1.Text = prt; Enbld.Checked = enabled; ///// vJoy Device properties int nBtn = joystick.GetVJDButtonNumber(id); int nDPov = joystick.GetVJDDiscPovNumber(id); int nCPov = joystick.GetVJDContPovNumber(id); bool X_Exist = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_X); bool Y_Exist = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_Y); bool Z_Exist = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_Z); bool RX_Exist = joystick.GetVJDAxisExist(id, HID_USAGES.HID_USAGE_RX); prt = String.Format("Device[{0}]: Buttons={1}; DiscPOVs:{2}; ContPOVs:{3}", id, nBtn, nDPov, nCPov); label2.Text = prt; UInt32 DllVer = 0, DrvVer = 0; bool match = joystick.DriverMatch(ref DllVer, ref DrvVer); if (match) prt = String.Format("Version of Driver Matches DLL Version {0:X}", DllVer); else prt = String.Format("Version of Driver ({0:X}) does NOT match DLL Version ({1:X})", DrvVer, DllVer); label7.Text = prt; long max = 10, min = 10; bool ok; ok = joystick.GetVJDAxisMax(id, HID_USAGES.HID_USAGE_X, ref max); ok = joystick.GetVJDAxisMin(id, HID_USAGES.HID_USAGE_X, ref min); ///// Write access to vJoy Device - Basic VjdStat status; status = joystick.GetVJDStatus(id); bool acq = joystick.AcquireVJD(id); status = joystick.GetVJDStatus(id); position.AxisX = 1000; position.AxisY = 5000; position.AxisZ = 10000; position.AxisXRot = 20000; position.Buttons = 0xA5A5A5A5; position.ButtonsEx1 = 0; bool upd = joystick.UpdateVJD(id, ref position); status = joystick.GetVJDStatus(id); //// Reset functions joystick.ResetButtons(id); // Register callback function // Function to register: Removal() // User data to pass: label2 joystick.RegisterRemovalCB(Removal, label2); }
public string getVersion() { return(joystick.GetvJoyVersion().ToString()); }