public MainForm() { InitializeComponent(); base.Disposed += OnDisposed; try { m_Interface = new vJoyInterfaceWrap.vJoy(); // Get the driver attributes (Vendor ID, Product ID, Version Number) if (!m_Interface.vJoyEnabled()) { Console.WriteLine("vJoy driver not enabled: Failed Getting vJoy attributes.\n"); return; } else { Console.WriteLine("v{0}\nVendor: {1}\nProduct :{2}\nVersion Number:{3}\n", m_Interface.GetvJoyVersion(), m_Interface.GetvJoyManufacturerString(), m_Interface.GetvJoyProductString(), m_Interface.GetvJoySerialNumberString()); } // Check which axes are supported bool AxisX = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_X); bool AxisY = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_Y); bool AxisZ = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_Z); bool AxisRX = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_RX); bool AxisRZ = m_Interface.GetVJDAxisExist(m_Id, HID_USAGES.HID_USAGE_RZ); // Get the number of buttons and POV Hat switchessupported by this vJoy device int nButtons = m_Interface.GetVJDButtonNumber(m_Id); int ContPovNumber = m_Interface.GetVJDContPovNumber(m_Id); int DiscPovNumber = m_Interface.GetVJDDiscPovNumber(m_Id); // Spit out the details Console.WriteLine(string.Format("Device[{0}]: Buttons={1}; DiscPOVs:{2}; ContPOVs:{3}", m_Id, nButtons, ContPovNumber, DiscPovNumber)); // Write access to vJoy Device - Basic VjdStat status = m_Interface.GetVJDStatus(m_Id); // Acquire the target if ((status == VjdStat.VJD_STAT_OWN) || ((status == VjdStat.VJD_STAT_FREE) && (!m_Interface.AcquireVJD(m_Id)))) { Console.WriteLine(string.Format("Failed to acquire vJoy device number {0}.", m_Id)); } else { Console.WriteLine(string.Format("Acquired: vJoy device number {0}.", m_Id)); m_Interface.ResetAll(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } m_Timer.Tick += OnTick; m_Timer.Interval = 2000; m_Timer.Start(); }