Declare Function joyGetDevCaps Lib "winmm.dll" Alias "joyGetDevCapsA" (ByVal id As Long, lpCaps As JOYCAPS, ByVal uSize As Long) As Long
Platforms: Win 95/98
joyGetDevCaps reads various information about a joystick. This information is put into the variable passed as lpCaps. This function does not, however, give you the current position of the joystick. The function returns 0 if the joystick is connected and working and a non-zero error code if it isn't.
Example:
' Display the name of the joystick driver for Joystick #1 ' Note that the ID of Joystick #1 is 0. Dim joyinfo As JOYCAPS ' receives joystick information Dim joydriver As String ' will be set to the joystick's driver name Dim retval As Long ' return value retval = joyGetDevCaps(0, joyinfo, Len(joyinfo)) ' read joystick information If retval = 0 Then ' there is a functioning Joystick #1 joydriver = Left(joyinfo.szPname, InStr(joyinfo.szPname, vbNullChar) - 1) ' extract data from the fixed-length string Debug.Print "The joystick driver is: "; joydriver Else Debug.Print "There is no joystick connected to Joystick Port #1." End If
Category: Joysticks
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/j/joygetdevcaps.html