Results 1 to 7 of 7

Thread: joygetposex

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    joygetposex

    Hey,

    Did anyone ever get the function joygetposex to work properly in vb.net??? This is my code. But the message is always 0.

    VB Code:
    1. Private Const JOY_BUTTON1 = &H1
    2.     Private Const JOY_BUTTON2 = &H2
    3.  
    4.     Private Const JOY_BUTTON1CHG = &H100
    5.     Private Const JOY_BUTTON2CHG = &H200
    6.  
    7.     Private Const JOY_RETURNBUTTONS = &H80&
    8.     Private Const JOY_RETURNCENTERED = &H400&
    9.     Private Const JOY_RETURNPOV = &H40&
    10.     Private Const JOY_RETURNPOVCTS = &H200&
    11.     Private Const JOY_RETURNR = &H8&
    12.     Private Const JOY_RETURNRAWDATA = &H100&
    13.     Private Const JOY_RETURNU = &H10
    14.     Private Const JOY_RETURNV = &H20
    15.     Private Const JOY_RETURNX = &H1&
    16.     Private Const JOY_RETURNY = &H2&
    17.     Private Const JOY_RETURNZ = &H4&
    18.     Private Const JOY_RETURNALL = (JOY_RETURNX Or JOY_RETURNY Or JOY_RETURNZ Or JOY_RETURNR Or JOY_RETURNU Or JOY_RETURNV Or JOY_RETURNPOV Or JOY_RETURNBUTTONS)
    19.  
    20.     Private Const JOY_USEDEADZONE = &H800&
    21.     Private Const MAXPNAMELEN = 32
    22.     Private Const INVALID_HANDLE_VALUE = -1
    23.  
    24.     Private Const JOYERR_BASE = 160
    25.     Private Const JOYERR_NOCANDO = (JOYERR_BASE + 6)
    26.     Private Const JOYERR_NOERROR = (0)
    27.     Private Const JOYERR_PARMS = (JOYERR_BASE + 5)
    28.     Private Const JOYERR_UNPLUGGED = (JOYERR_BASE + 7)
    29.  
    30.     Private Const JOYSTICKID1 = 0
    31.     Private Const JOYSTICKID2 = 1
    32.  
    33.     ' ===================================
    34.     ' Declaration of User Defined types both private and public
    35.  
    36.     Private Structure JOYINFOEX
    37.         Friend dwSize As Integer                 '  size of structure
    38.         Friend dwFlags As Integer                '  flags to indicate what to return
    39.         Friend dwXpos As Integer                 '  x position
    40.         Friend dwYpos As Integer                 '  y position
    41.         Friend dwZpos As Integer                 '  z position
    42.         Friend dwRpos As Integer                 '  rudder/4th axis position
    43.         Friend dwUpos As Integer                 '  5th axis position
    44.         Friend dwVpos As Integer                 '  6th axis position
    45.         Friend dwButtons As Integer              '  button states
    46.         Friend dwButtonNumber As Integer         '  current button number pressed
    47.         Friend dwPOV As Integer                  '  point of view state
    48.         Friend dwReserved1 As Integer            '  reserved for communication between winmm driver
    49.         Friend dwReserved2 As Integer            '  reserved for future expansion
    50.     End Structure
    51.  
    52.     ' ======================================
    53.     ' Event Arguments for ErrorOccured event
    54.     ' ======================================
    55.     Private Declare Function joyGetPosEx Lib "winmm.dll" (ByVal uJoyID As Integer, ByRef pji As JOYINFOEX) As Integer
    56.  
    57.  
    58.  
    59.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    60.         Dim a As JOYINFOEX
    61.  
    62.         a.dwSize = Len(a)
    63.         a.dwFlags = JOY_RETURNBUTTONS
    64.  
    65.         joyGetPosEx(JOYSTICKID1, a)
    66.         MessageBox.Show(a.dwButtons)
    67.     End Sub
    Don't anthropomorphize computers -- they hate it

  2. #2

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    Never mind.
    Don't anthropomorphize computers -- they hate it

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    You are in luck fella!

    Go check this out...

    http://www.vbforums.com/showthread.p...71#post1826471
    (download the zip file and use the DLL in your project)

    This DLL (written by me and some of the ChitChat crew) contains a joystick class that completely wraps this API and a few others to deliver advanced multiple joystick support to your games.

    Please feel free to read the rest of that thread from the start, it'll fill you in on a few details.

    At the moment there is no documentation, but this is only the alpha test release. We would really appreciate your help with testing if you could

    Cheers.
    I don't live here any more.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    the docs are going to suck, anyways. just, because!

  5. #5
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: joygetposex

    I have downloaded the Sandpaper.dll. but I didn't find anything about joystick. I see there is no documentation, but the sample projects don't mention how to access the joystick wrapper either.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: joygetposex

    You have to add a reference to the sandnet.dll file.

    There may be a reference already there, so delete it and add a new reference by browsing to the dll manually.

    You can use the joystick wrapper either my manually polling the data, or by using its event driven mode.

    You are right about the docs though. We never got around to writing them
    I don't live here any more.

  7. #7
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: joygetposex

    it's ok
    i downloaded the DX9 sdk and the sample app for joystick was pretty straightforward.
    Thanks for the follow-up though.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

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