VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyG

by kevin lynch (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 28th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyGetDevCaps(joy, jc, Len(jc)) <>

Rate Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyG



   Dim jc As JOYCAPS
   
   If joyGetDevCaps(joy, jc, Len(jc)) <> JOYERR_NOERROR Then
      GetJoyMin = False
      
   Else
      ji.X = jc.wXmin
      ji.Y = jc.wYmin
      ji.Z = jc.wZmin
      ji.Buttons = jc.wNumButtons
   
      GetJoyMin = True
   End If
End Function
'
'  Fills the ji structure with the maximum x, y, and z
'  coordinates.  Buttons is filled with the number of
'  buttons.
'
Public Function GetJoyMax(ByVal joy As Integer, ji As JOYINFO) As Boolean
   Dim jc As JOYCAPS
   
   If joyGetDevCaps(joy, jc, Len(jc)) <> JOYERR_NOERROR Then
      GetJoyMax = False
      
   Else
      ji.X = jc.wXmax
      ji.Y = jc.wYmax
      ji.Z = jc.wZmax
      ji.Buttons = jc.wNumButtons
   
      GetJoyMax = True
   End If
End Function
Public Function GetJoystick(ByVal joy As Integer, ji As JOYINFO) As Boolean
   If joyGetPos(joy, ji) <> JOYERR_NOERROR Then
      GetJoystick = False
   Else
      GetJoystick = True
   End If
End Function

'
'  If IsConnected is False then it returns the number of
'  joysticks the driver supports. (But may not be connected)
'
'  If IsConnected is True the it returns the number of
'  joysticks present and connected.
'
'  IsConnected is true by default.
'
Public Function IsJoyPresent(Optional IsConnected As Variant) As Long
   Dim ic As Boolean
   Dim i As Long
   Dim j As Long
   Dim ret As Long
   Dim ji As JOYINFO
   
   ic = IIf(IsMissing(IsConnected), True, CBool(IsConnected))

   i = joyGetNumDevs
   
   If ic Then
      j = 0
      Do While i > 0
         i = i - 1   'Joysticks id's are 0 and 1
         If joyGetPos(i, ji) = JOYERR_NOERROR Then
            j = j + 1
         End If
      Loop
   
      IsJoyPresent = j
   Else
      IsJoyPresent = i
   End If
   
End Function

Download this snippet    Add to My Saved Code

Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyG Comments

No comments have been posted about Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyG. Why not be the first to post a comment about Public Function GetJoyMin(ByVal joy As Integer, ji As JOYINFO) As Boolean Dim jc As JOYCAPS If joyG.

Post your comment

Subject:
Message:
0/1000 characters