| Usuario |
Programacion con USB |
vivasmaq
1 Mensaje(s)
|
| Enviado - 17/6/2004 |
| |
| Alguno me podria dar un indicio de como empezar a programar o controlar un joystick, mas especificamente el joystick de microsoft sidewinder joystick con conexion usb. Seria mas especifico si puden ayudarme a hacerlo en visual basic.gracias |
| |
|
Desconocido
|
| Enviado - 24/6/2004 |
| |
'Prueba con funciones del API para obtener el estado del joystick:
Type JOYINFO
wXpos As Integer
wYpos As Integer
wZpos As Integer
wButtons As Integer
End Type
Type JOYINFOEX
dwSize As Long ' size of structure
dwFlags As Long ' flags to indicate what to return
dwXpos As Long ' x position
dwYpos As Long ' y position
dwZpos As Long ' z position
dwRpos As Long ' rudder/4th axis position
dwUpos As Long ' 5th axis position
dwVpos As Long ' 6th axis position
dwButtons As Long ' button states
dwButtonNumber As Long ' current button number pressed
dwPOV As Long ' point of view state
dwReserved1 As Long ' reserved for communication between winmm driver
dwReserved2 As Long ' reserved for future expansion
End Type
Declare Function joyGetPos Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFO) As Long
Declare Function joyGetPosEx Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFOEX) As Long
Dim InfoJoy As JOYINFO
Dim InfoJoyEX As JOYINFOEX
'Ejemplo para llamar las funciones:
Dim IDJoy As Long
IDJoy = joyGetPos(0, InfoJoy)
IDJoy = joyGetPosEx(0, InfoJoyEX)
'Las dos te dan el estado del joystick pero se visualiza en diferente forma.
'Para llamar la configuracion del joystick se puede lo siguiente:
Dim xDisp As Long
xDisp = Shell("rundll32.exe shell32.dll, Control_RunDLL joy.cpl", 0) |
| |
|
|
|