none
How do I interface with a USB Joystick

    Question

  • I'm looking for some example code that would illustrate interfacing to a USB joystick using Visual C++ and DirectX / DirectInput.  anybody know of something?

    Thanks!
    Friday, September 25, 2009 7:42 PM

Answers

  • I highly recommend using VS2008, and porting your code forward to it.

    There were quite a few C++ standards compatibility issues that were fixed in VS2005 - It's much easier to use example code and work in 2008 (there's a reason MS has had new versions, and they are definitely worthwhile!).

    Also, the DirectX SDK only (directly) supports VS 2005 and 2008, in its current release.  All sample projects are provided as 2005 & 2008 solutions.

    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Wesley Yao Friday, October 02, 2009 2:56 AM
    Tuesday, September 29, 2009 3:54 PM

All replies

  • MSDN has a Joystick Sample that should work fine, provided you have a USB joystick supported by DirectInput.

    Reed Copsey, Jr. - http://reedcopsey.com
    Friday, September 25, 2009 7:54 PM
  • Cool thanks.  I am assuming the Microsoft Sidewinder joystick (probably most USB joysticks) support Direct Input?
    Tuesday, September 29, 2009 12:34 PM
  • I'm also doing the coding in visual studio 2003.  I have both 2008 and 2003.  The example builds in 2008 and I can interface with a game pad I rounded up. 

    However, the software I intend to integrate the joystick with is in visual studio 2003.  I made a new project and can get everything to build with one exception.  It refuses to open / link the "dxerr.lib".  I have the proper include paths and the lib works with 2008.

    Is it possible that lib file is not compatible with 2003?  Does anybody know if it is possible do coonvert the direct input joystick interface to visual studio 2003?

    Thanks!

    Tuesday, September 29, 2009 3:11 PM
  • I highly recommend using VS2008, and porting your code forward to it.

    There were quite a few C++ standards compatibility issues that were fixed in VS2005 - It's much easier to use example code and work in 2008 (there's a reason MS has had new versions, and they are definitely worthwhile!).

    Also, the DirectX SDK only (directly) supports VS 2005 and 2008, in its current release.  All sample projects are provided as 2005 & 2008 solutions.

    Reed Copsey, Jr. - http://reedcopsey.com
    • Marked as answer by Wesley Yao Friday, October 02, 2009 2:56 AM
    Tuesday, September 29, 2009 3:54 PM
  • Do you know where can i get the joystick sample from MSDN cos i can't find the path to the sample program in my PC.
    Monday, July 11, 2011 8:43 AM
  • The SDKs include their samples. Did you download and install the current Direct X SDK?

     

    Monday, July 11, 2011 3:23 PM