Jump to content

Getting Raw Input


Recommended Posts

I've been trying to get the rawinput api's to work for awhile now and I'm still pretty stumped. I started off trying to do it in vb but failed so I moved right on to try in autoit.

What I'm trying to do is get raw input from a usb device (a PS2 Dvd Remote) and then act on it. The problem is getting the input. I can find the device and read it's info(just the basic string that's stored in the registry or whatever) and it tells me that it found the correct device. I don't know how to get the input though. I know this is kinda advanced but I wouldn't post it here if it wasn't.


Const $RIDI_DEVICENAME = 0x20000007
Const $RID_INPUT = 0x10000003
Const $RID_HEADER = 0x10000005
;MsgBox(0,"Call Return:",$temp)
$devnum = DllStructGetData($numdevices,1)
MsgBox(0,"Number of Devices:",$devnum)
;Dim $rid[4]
$temp = ""
For $i = 1 to ($devnum-1)
    $temp=$temp & "dword;dword;"
$temp = $temp & "dword;dword"
$dwsize = $numdevices * DllStructGetSize($ridl)
;MsgBox(0,"Call Return:",$temp)
For $i = 0 to ($devnum-1)
    MsgBox(0,"Device: " & $i, "Handle: " & DllStructGetData($rid,($i*2)+1) & " Type: " & DllStructGetData($rid,($i*2)+2) & " Name: " & DllStructGetData($devname,1))
    If StringInStr(DllStructGetData($devname,1),"Vid_0925") <> 0 Then;works up to here
        MsgBox(0,"Score!","Playstation 2 Dvd Remote Found!")
        $remotehwnd = DllStructGetData($rid,($i*2)+1)
        $i = 99
;here's the call that i can't get working
$temp = DllCall("user32.dll","int","GetRawInputData", _
    "long",$remotehwnd,"int",$RID_HEADER, _
    "ptr",0,"long",$size, _
    "long",DllStructGetSize($RawInputHeader) )
$ourError = DLLCall("kernel32.dll","int","GetLastError")
MsgBox(0,"Call Return:",$temp)
For $i = 1 to 7
MsgBox(0,"Data Lister:",DllStructGetData($RawInput,$i))
Link to comment
Share on other sites

You may wish to check out some usb sniffers with available source, such as snoopy (a sourceforge project) -- this would let you see the syntax being used in those development languages, perhaps easing a port to au3 or (gasp) vb. I like the following link as a jumping off point for things USB. http://www.lvr.com/usb.htm

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...