VB6 - USBHID. Reading Data from USB HID Keyboard Device.



Allo!
I am attempting to view data sent to my computer via my keyboard (To control
the extra multimedia functions [e.g. volume control] because it doesn't seem
to do anything. [Not the reason for this question])

Ho'kay, I'm am using Visual Basic 6.0 on a Windows Vista PC.

Basically, what I will try to end up doing, is when I use the functions,
it'll control Winamp, I already have code for controlling Winamp though, but
can't quite seem to get the keyboard data.

My current code, goes thusly;

* Module1

1 Public Type SECURITY_ATTRIBUTES
2 nLength As Long
3 lpSecurityDescriptor As Long
4 bInheritHandle As Long
5 End Type
6
7 Public Type OVERLAPPED
8 Internal As Long
9 InternalHigh As Long
10 offset As Long
11 OffsetHigh As Long
12 hEvent As Long
13 End Type
14
15 Public Const GENERIC_READ = &H80000000
16 Public Const GENERIC_WRITE = &H
17 Public Const OPEN_EXISTING = 340000000

* Form1

1 Dim longbuffer As Long
2 Dim HidName$
3 Dim result
4 Dim OverLap As OVERLAPPED
5
6 Private Sub Form_Load()
7 Dim Security As SECURITY_ATTRIBUTES
8 Security.nLength = 12&
9 Security.lpSecurityDescriptor = 0&
10 Security.bInheritHandle = False
11 Text1.Text = ""
12 Timer1.Interval = 1
13 HidName$ =
"\\?\hid#vid_413c&pid_2010&mi_01&col03#8&1b0ad425&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}"
14 result = CreateFile( _
15 HidName$, _
16 GENERIC_READ, _
17 0, _
18 Security, _
19 OPEN_EXISTING, _
20 0, _
21 0)
22 End Sub
23
24 Private Sub Timer1_Timer()
25 Dim feedme As String
26 feedme = ReadFile(result, 1, 1, 0, OverLap)
27 If feedme <> 0 Then Text1.Text = Text1.Text & feedme
28 End Sub

I think I got the 'HidName$' variable right, I've never attempted this before.
Hope someone can help me with this and I thank you all in advance!
.



Relevant Pages

  • Re: 1994 Cincinnati Sabre 750 acramatic 850sx keyboard error
    ... I have the keyboard with the raised rubber pushbottons. ... Are you talking about the ribbon cables that attach to the keyboard ... What puzzles me is the fact that after a control ... Seems like you mentioned it to be a 1994 model, that may be why you don't have the ribbon cable type control I was talking about. ...
    (alt.machines.cnc)
  • Re: Value and Text Properties of controls
    ... listbox class object to emulate the actual listbox on the form, ... ran into another bug dealing with listbox selections via keyboard method. ... default error checking stuff on a control by control basis, ... One of the reasons why I put in checks on a control by control basis, ...
    (microsoft.public.access.formscoding)
  • Re: 1994 Cincinnati Sabre 750 acramatic 850sx keyboard error
    ... Its the qwerty keyboard and the machine control panel on the right, ... I have the keyboard with the raised rubber pushbottons. ... Some of the keys were getting sticky so I removed the ...
    (alt.machines.cnc)
  • xmodmap modifier alt/meta/windows beim Umstieg SuSE 9->10 kaputt
    ... Der Dialog Control Center> Regional and Accessibility> Keyboard ...
    (de.comp.os.unix.linux.misc)
  • Re: How can I stop controls from executing default keyboard and mouse behavior?
    ... > acted upon even if the Ctrl keys were also being pressed. ... so that control is badly written. ... not react to the keyboard when they don't have the focus. ... > The general problem is controls executing built-in behavior that I ...
    (alt.comp.lang.borland-delphi)