Declare Function joyGetDevCaps Lib "winmm.dll" Alias "joyGetDevCapsA" (ByVal id As Long, ByVal lpCaps As JOYCAPS, ByVal uSize As Long) As Long
lpCaps
. This is not to be confused with getting the current status of the joystick. The return value is an error code. If it is zero, the joystick is connected and in working order.
id | The ID # of the joystick to read. Windows 95 starts counting joysticks at 0, so Joystick 1's ID is 0, Joystick 2's ID is 1, etc. |
lpCaps | Receives the information about the joystick. |
uSize | The length in bytes of lpCaps (use the Len function).
|
'Check to see if Joystick 1 is connected
DIM cap As JOYCAPS
x = joyGetDevCaps(0, cap, Len(cap))
If x = 0 Then Debug.Print "Joystick 1 is in full working order."
Declare Function joyGetNumDevs Lib "winmm.dll" () As Long
'Look for the number of configured joysticks
num_joysticks = joyGetNumDevs()
Declare Function joyGetPos Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFO) As Long
pji
. The value returned is an error code. If it is zero, the joystick is connected and in working order.uJoyID | The ID # of the joystick to read. Windows 95 starts counting joysticks at 0, so Joystick 1's ID is 0, Joystick 2's ID is 1, etc. |
pji | Receives the joystick's current position. |
'Read the x and y coordinates
Dim pos As JOYINFO
x = joyGetPos(0, pos)
Debug.Print pos.wXpos, pos.wYpos
Paul Kuliniewicz
E-mail: Borg953@aol.com
All material presented on these pages is Copyright © Paul Kuliniewicz, except for other copyrighted material.
http://members.aol.com/Borg953/api/j.html