I'm attempting to open an USB HID device using createfile from kernel32.
The open attempt always fails. This is the call I'm using:
CreateFile(HidName$, &HC0000000, 3, 0, 3, 0 ,0)
HidName$ gets assigned the device:
\\?\hid
#vid_7766&pid_1629
#6&1b9813bf&0&0000
#{4d1e55b2-f16f-11cf-88cb-00111100030}
(its actually 1 string, I entered linebreaks here at the # marks for
readability)
Createfile is defined as:
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA"
_(ByVal lpFileName$, ByVal dwDesiredAccess&,
_ ByVal dwShareMode&,lpSecurityAttributes&,
_ ByVal dwCreationDisposition&, ByVal dwFlagsAndAttributes&,
_ ByVal hTemplateFile&) As Long
No matter what, the CreateFile call always returns -1. I've tried it with
multiple HID devices to ensure I'm finding the correct device name.
This is VB 6.0 on Win2k.
Any ideas?
-James