Archived

This topic is now archived and is closed to further replies.

windows joystick messages

This topic is 5239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve figured out (thanks to an MSDN sample prog) how to detect joystick motion and button presses (for the first 4 buttons...). How do I use the throttle and hat switch, or even the other buttons? I''m doing this in an MFC app, so I''d rather not use DirectInput. I can only find references to DI when I look it up in MSDN. Thanks. --------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Share this post


Link to post
Share on other sites
Try querying joystick 2 for the remaining controls. If that doesn''t work, then you are out of luck and DirectInput would be required to get access to those.

Share this post


Link to post
Share on other sites
Did I mention that it''s a USB joystick? I don''t think that would matter, except for the Joystick2 thing... I''d guess that USB doesn''t use both sticks.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Share this post


Link to post
Share on other sites
Are you using the winmm joystick functions? That library supports up to 32 button joysticks and hat switches. You should be calling joyGetPosEx (as opposed to joyGetPos). Look at the values that come back in the JOYINFOEX structure. Here is an excerpt from MSDN:
quote:

dwButtons
Current state of the 32 joystick buttons. The value of this member can be set to any combination of JOY_BUTTONn flags, where n is a value in the range of 1 through 32 corresponding to the button that is pressed.

dwPOV
Current position of the point-of-view control. Values for this member are in the range 0 through 35,900. These values represent the angle, in degrees, of each view multiplied by 100.

Point-Of-View Flag Description
JOY_POVBACKWARD Point-of-view hat is pressed backward. The value 18,000 represents an orientation of 180.00 degrees (to the rear).
JOY_POVCENTERED Point-of-view hat is in the neutral position. The value -1 means the point-of-view hat has no angle to report.
JOY_POVFORWARD Point-of-view hat is pressed forward. The value 0 represents an orientation of 0.00 degrees (straight ahead).
JOY_POVLEFT Point-of-view hat is being pressed to the left. The value 27,000 represents an orientation of 270.00 degrees (90.00 degrees to the left).
JOY_POVRIGHT Point-of-view hat is pressed to the right. The value 9,000 represents an orientation of 90.00 degrees (to the right).




As for the throttle, I would just look at the return values of some of the other members in that structure and see if the throttle is updating them. Hope that gets you started.



All you will ever need to know.

Share this post


Link to post
Share on other sites
I''m not using the winmm functions, except for the capture joystick one. I''m reacting to the joystick move and button messages that windows sends. Since I have an MFC app, I don''t think manually polling the joyGetPosEx() function is an option. I don''t know how to create a looping piece of code like that in MFC, unless I set a timer to a really short amount of time...

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Share this post


Link to post
Share on other sites