Microsoft Sidewinder ansprechen

    • Offizieller Beitrag

    Ich hatte mal mit USB-Joypads experimentiert und habe im engl. Forum ein paar Funktionen dazu gefunden.
    Vielleicht hilft Dir das weiter:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $hJoy
    Global $sTitle = 'Joy-Test'
    Global $hGui = GUICreate($sTitle, 1200, 740)
    Global $hListview = GUICtrlCreateListView('0|0|0|0|0|0|0|0', 10, 10, 1180, 720)
    Global $aJoy = _NumberJoy()
    Global $hLVItem[$aJoy[0]+1]
    For $i = 1 To $aJoy[0]
    $hLVItem[$i-1] = GUICtrlCreateListViewItem('0|0|0|0|0|0|0|0', $hListview)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Global $aAllJoy

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    AdlibRegister('My_WM_USER_Function', 10)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    AdlibUnRegister('My_WM_USER_Function')

    [/autoit] [autoit][/autoit] [autoit]

    Func My_WM_USER_Function()
    $a = TimerInit()
    $aAllJoy = _GetAllJoy($aJoy)
    ToolTip(TimerDiff($a))
    For $i = 1 To $aJoy[0]
    GUICtrlSetData($hLVItem[$i-1], $aAllJoy[$i-1])
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetAllJoy(ByRef $aJoy)
    Local $aAllJoy[$aJoy[0]+1], $aTmp
    For $i = 1 To $aJoy[0]
    $lpJoy = _JoyInit()
    $aTmp = _GetJoy($lpJoy, $aJoy[$i])
    For $j = 0 To 7
    $aAllJoy[$i-1] &= $aTmp[$j] & '|'
    Next
    Next
    Return $aAllJoy
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _NumberJoy()
    Local $aTmp, $j = 0, $aJoy[1] = [0], $lpJoy
    For $i = 0 To 15
    $lpJoy = _JoyInit()
    $aTmp = _GetJoy($lpJoy, $i)
    If $aTmp[0] <> 0 Then
    $j += 1
    ReDim $aJoy[$j + 1]
    $aJoy[$j] = $i
    $aJoy[0] = $j
    EndIf
    Next
    Return $aJoy
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;____________________________________________________________________
    ; Original program by Ejoc ;
    ; Improved by Adam1213 (autoit 3.2 compatiblity + improved labels ;
    ;____________________________________________________________________

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _JoyInit()
    ;======================================
    Func _JoyInit()
    Global $JOYINFOEX_struct = "dword[13]"
    Local $joy = DllStructCreate($JOYINFOEX_struct)
    DllStructSetData($joy, 1, DllStructGetSize($joy), 1);dwSize = sizeof(struct)
    DllStructSetData($joy, 1, 255, 2) ;dwFlags = GetAll
    Return $joy
    EndFunc ;==>_JoyInit

    [/autoit] [autoit][/autoit] [autoit]

    ;======================================
    ; _GetJoy($lpJoy,$iJoy)
    ; $lpJoy Return from _JoyInit()
    ; $iJoy Joystick # 0-15
    ; Return Array containing X-Pos, Y-Pos, Z-Pos, R-Pos, U-Pos, V-Pos,POV
    ; Buttons down
    ;
    ; *POV This is a digital game pad, not analog joystick
    ; 65535 = Not pressed
    ; 0 = U
    ; 4500 = UR
    ; 9000 = R
    ; Goes around clockwise increasing 4500 for each position
    ;======================================
    Func _GetJoy($lpJoy, $iJoy)
    Local $coor[8], $ret
    DllCall("Winmm.dll", "int", "joyGetPosEx", "int", $iJoy, "ptr", DllStructGetPtr($lpJoy))
    If Not @error Then
    $coor[0] = DllStructGetData($lpJoy, 1, 3)
    $coor[1] = DllStructGetData($lpJoy, 1, 4)
    $coor[2] = DllStructGetData($lpJoy, 1, 5)
    $coor[3] = DllStructGetData($lpJoy, 1, 6)
    $coor[4] = DllStructGetData($lpJoy, 1, 7)
    $coor[5] = DllStructGetData($lpJoy, 1, 8)
    $coor[6] = DllStructGetData($lpJoy, 1, 11)
    $coor[7] = DllStructGetData($lpJoy, 1, 9)
    EndIf
    Return $coor
    EndFunc ;==>_GetJoy

    [/autoit]
  • Danke Oscar, das hat mir schon mal etwas geholfen, nur verstehe ich das Script noch nicht richtig, DjDominik hat mir schon zum Dependency Walker geraten und versucht ihn mir zu erklären, aber dort die funktionen raussuchen bzw benutzen ist ein Buch mit 7 Sigeln ;(

    vllt. könntest du das Script etwas Kommentieren^^