Results 1 to 5 of 5

Thread: use joystickes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2009
    Posts
    17

    Arrow use joystickes

    Dear friend
    I want to use joystickes in my program
    to add points by pressing buttons
    i need code to program USB port of the computer so i can press boutton from the joysticks. thank you and God Bless you

  2. #2
    Fanatic Member
    Join Date
    Sep 2009
    Location
    Lakewood, Colorado
    Posts
    621

    Re: use joystickes

    This thread may be what you need: http://www.vbforums.com/showthread.php?t=317362
    Richard Grier, Consultant, Hard & Software
    Microsoft MVP (Visual Basic)

  3. #3
    Fanatic Member
    Join Date
    Sep 2009
    Location
    Lakewood, Colorado
    Posts
    621

    Re: use joystickes

    Sorry, my other reply was with reference to VB .NET. However, there are a number of suggestions on google. Just enter the keywords VB6 Joystick (DirectX or USB).
    Richard Grier, Consultant, Hard & Software
    Microsoft MVP (Visual Basic)

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 2009
    Posts
    17

    Re: use joystickes

    More details so to make everyone understand what I want,

    I want to use joystickes in my VB6 program
    to add points numbers to label or text in VB6 by pressing buttons of the joystickes,
    i need VB6 code to my program joystickes USB port of the computer so i can press boutton from the joysticks
    and 1 point number count in the label in my program, and when I press again 1 point number will be added,
    so the label will show 2, and when I press again will show 3 and so on,
    Thank you Very Much.

  5. #5
    Fanatic Member
    Join Date
    Sep 2009
    Location
    Lakewood, Colorado
    Posts
    621

    Re: use joystickes

    Try this to get Input from the Joystick:

    Declare Function joyGetPos Lib "winmm.dll" _
    (ByVal uJoyID As Long, pji As JOYINFO) As Long

    Type JOYINFO
    wXpos As Long
    wYpos As Long
    wZpos As Long
    wButtons As Long
    End Type


    Public Function GetJSValues(x As Long, y As Long, _
    z As Long, Button1 As Boolean, Button2 As Boolean, _
    Button3 As Boolean, Button4 As Boolean)

    'Get access to the Type JOYINFO.
    Dim pos As JOYINFO

    'Get the x, y and z values.
    x = pos.wXpos
    y = pos.wYpos
    z = pos.wZpos

    'Get the status of the Buttons.
    Button1 = pos.wButtons And 1
    Button2 = pos.wButtons And 2
    Button3 = pos.wButtons And 4
    Button4 = pos.wButtons And 8
    'Follow the pattern above to get other buttons.

    End Function
    Richard Grier, Consultant, Hard & Software
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width