Re: WH_KEYBOARD_LL not capture all key events




Hello Paul,

thanks for answer my question! OK, you don't want to pass me your email
address. Not problem. One thing, I use a global hook because I think there is
the only way to capture all keyboard input events. I want to do this because
I'm working in an application for people with cannot look very well, and I
want to make a program that reads the letter the user is pushing in the
keyboard. I'm an university researcher in Spain, Barcelone.

OK, now, I understand you. The fact is that the SIP keyboard is not the same
that a real keyboard, and maybe you are reason and the events generated goes
directly to the application, and because of that the hook doesn't caught
them. But it's strange, how do you explain the fact that some keys are
recognized by the hook and others not? If you have some documentation or
sites web that explain this, tell me please.

Now I am not expert in SIP Keyboard and i want to know if there exists some
way to know how letter the user has pushed. I know, for example, that there
is a way to know if the keyboard are visible or no in the screen in this
moment. I'm looking for in MSDN web page: Based Input Model Software. Do you
have any ideas?

Finally, my last solution is that, i can capture the position (x,y) the user
clicks, and so i'm going to determine which letter the user presses due to a
its position. It's not the better solution but its the thing that i can do by
the moment. If you know other alternatives tell me, ok?

Thank you very much Paul,

Sincerely,

javitobcn




"Paul G. Tobey [eMVP]" wrote:

> Yes, but *why* are you using a hook? I understand *what* you are trying to
> do, but that's not what I care about. Maybe you're doing it for the wrong
> reason. For what purpose are you trying to capture all keyboard I/O?
>
> At a guess, the keyboard I/O probably does *not* go through the full input
> system when it is coming from a SIP. The SIP knows about the current
> application, so it's probably sending the keyboard data directly to that
> application, bypassing the normal input routing. As I said, *real* keyboard
> input *does* go through the global hook, so it's not an issue of the hook
> never seeing the data; it's an issue of how you are generating the data (via
> the SIP).
>
> Paul T.
>
> "xbsantos" <xbsantos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:6E36A702-5B43-4748-A604-8941098F8E4F@xxxxxxxxxxxxxxxx
> >
> > Hello Paul, how are you?
> >
> > It's very important for me because it's my final research project in the
> > computer science engineery. I'm student of the Barcelone University in
> > Spain.
> >
> > I don't understand your last explanation. I think that you don't
> > understand
> > very well my problem.
> >
> > I'm using a global hook (low level keyboard) in order to monitorize all
> > key
> > events. ok? But the problem is that, when I pushed a key, the global hook
> > doesn't capture any event(WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR,
> > WM_SYSCHAR...)
> > and I want to know why.
> >
> > If you try with a local hook, there is no problem, and you can capture all
> > key events, so the events are produced in the PDA when you touch the
> > keyboard
> > screen. So I think, the events are produced, but are not caught by the
> > hook.
> >
> > It's strange because some keys are caught in the global hook, for example:
> > caps lock, tab, esc, and so on.
> >
> > Do you understand now? Thanks for your help Paul.
> >
> > If you want we can continue our communication by e-mail. My email is
> > XBSANTOS@xxxxxxxx, and I can pass you the code, and so on.
> >
> > Thank you very much,
> >
> > Sincerely,
> >
> > javitobcn
> >
> > "Paul G. Tobey [eMVP]" wrote:
> >
> >> It's not translating them to real keyboard events, as my real
> >> keyboard-equipped device *does* get those events in the low-level
> >> keyboard
> >> hook.
> >>
> >> Why is it very important? What are you trying to do?
> >>
> >> Paul T.
> >>
> >> "xbsantos" <xbsantos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> news:ED922DFF-3851-4CF0-B113-278F2464D5A1@xxxxxxxxxxxxxxxx
> >> >
> >> > Hello Paul,
> >> >
> >> > How are you? First of all, thank you very much for answer my question.
> >> > It's
> >> > very important for me.
> >> >
> >> > I tell you: I'm working in a PocketPC with Windows CE, and in fact, the
> >> > PDA
> >> > hasn't real keyboard. The keyboard is based in the screen ("touch
> >> > screen").
> >> > The Software Input Panel translates these events into real keyboard
> >> > events,
> >> > so I think this is not the problem.
> >> >
> >> > The problem is that I'm using a WH_KEYBOARD_LL hook in order to
> >> > monitorize
> >> > all keyboard events, but I only can capturate some keys, not all the
> >> > keys
> >> > availables in the keyboard. For example, I only can trap caps lock,
> >> > esc,
> >> > tab,
> >> > etc. and my question is why this? Why I can not capturate all keyboard
> >> > events? I'm waiting for your answer. It's very important.
> >> >
> >> > Thanks for your help, and if you don't understand something, please ask
> >> > me.
> >> >
> >> >
> >> > Sincerely,
> >> >
> >> > javitobcn
> >> >
> >> >
> >> >
> >> > "Paul G. Tobey [eMVP]" wrote:
> >> >
> >> >> For real keyboard I/O, I get events for those ordinary keys. It must
> >> >> be
> >> >> the
> >> >> Software Input Panel not sending them as regular keys. Why are you
> >> >> doing
> >> >> this?
> >> >>
> >> >> Paul T.
> >> >>
> >> >> "xbsantos" <xbsantos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> >> news:E009CA20-A883-40A3-91CD-C79950973570@xxxxxxxxxxxxxxxx
> >> >> >
> >> >> > No, I don't get WM_CHAR for those characters in the keyboard. I
> >> >> > don't
> >> >> > know
> >> >> > the reason. The procedure that the hook calls is
> >> >> > LowLevelKeyboardProc,
> >> >> > but
> >> >> > when I pushed the key A for example, there isn't a call to this
> >> >> > procedure,
> >> >> > so
> >> >> > that wants to say that no keyboard message is captured by global
> >> >> > hook
> >> >> > WH_KEYBOARD_LL. Maybe it's a problem of the windows focus. But it's
> >> >> > strange
> >> >> > because in a few number of keys I obtain the messages. For example:
> >> >> > caps
> >> >> > lock, tab, esc, and so on.
> >> >> >
> >> >> > Do you understand me? Thank you very much for your answer, and if
> >> >> > you
> >> >> > know
> >> >> > something, please say to me.
> >> >> >
> >> >> > Sincerely,
> >> >> >
> >> >> > javitobcn
> >> >> >
> >> >> >
> >> >> >
> >> >> > "Paul G. Tobey [eMVP]" wrote:
> >> >> >
> >> >> >> It's not clear from your description exactly what the problem is.
> >> >> >> You
> >> >> >> might
> >> >> >> not get a WM_KEYDOWN for every key ('a', 'b', 'c' or whatever), but
> >> >> >> you
> >> >> >> should get a WM_CHAR for those.
> >> >> >>
> >> >> >> Paul T.
> >> >> >>
> >> >> >> "xbsantos" <xbsantos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> >> >> news:D9D1EE6B-0C0F-42DE-AEE6-85B16D0A1895@xxxxxxxxxxxxxxxx
> >> >> >> > WH_KEYBOARD_LL not capture all key events
> >> >> >> >
> >> >> >> > I have a problem. I'm using a WH_KEYBOARD_LL hook in order to
> >> >> >> > capture
> >> >> >> > all
> >> >> >> > system keyboard events.
> >> >> >> > I create the hook without problems, but when I want to delete it,
> >> >> >> > the
> >> >> >> > function unhookWindowsHookEx()
> >> >> >> > returns a FALSE (that wants to say error in the function), but
> >> >> >> > the
> >> >> >> > hook
> >> >> >> > is
> >> >> >> > correctly deleted,
> >> >> >> > because if after I create another WK_KEYBOARD_LL hook, it will be
> >> >> >> > created
> >> >> >> > correctly.
> >> >> >> >
> >> >> >> > But my main problem is that in the LowLevelKeyboardProc (the hook
> >> >> >> > process),
> >> >> >> > I cannot detect
> >> >> >> > all keyboard events of all the applications of my pda pocket pc.
> >> >> >> > I
> >> >> >> > only
> >> >> >> > detect the message
> >> >> >> > WM_KEYDOWN in a few number of keys such as: caps lock, shift,
> >> >> >> > esc,
> >> >> >> > and
> >> >> >> > so
> >> >> >> > on. And I want to detect
> >> >> >> > all keyboard events. What do you think that could be the problem?
> >> >> >> >
> >> >> >> > I ask for your help, please. It's very important for me.
> >> >> >> >
> >> >> >> > Here you have the declaration of the LowLevelKeyboardProc:
> >> >> >> >
> >> >> >> > __declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc (int
> >> >> >> > code,
> >> >> >> > WPARAM wParam, LPARAM lParam)
> >> >> >> >
> >> >> >> > Create the hook:
> >> >> >> >
> >> >> >> > m_hHkKeyboard = m_pfSetWindowsHook(WH_KEYBOARD_LL,
> >> >> >> > LowLevelKeyboardProc,
> >> >> >> > aInstance, (DWORD)NULL);
> >> >> >> >
> >> >> >> > where: m_pfSetWindowsHook is a pointer to the SetWindowsHookExW
> >> >> >> > function;
> >> >> >> >
> >> >> >> > and delete the hook:
> >> >> >> >
> >> >> >> > m_pfUnhookWindowsHook(m_hHkKeyboard)
> >> >> >> >
> >> >> >> > where: m_pfUnhookWindowsHook is a pointer to the
> >> >> >> > UnHookWindowsHookEx
> >> >> >> > function;
> >> >> >> >
> >> >> >> > I'm waiting for your answers. Thank you very much.
> >> >> >> >
> >> >> >> > Sincerely,
> >> >> >> >
> >> >> >> > javitobcn,
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
.



Relevant Pages

  • RE: Problem Overriding Word menu items using VSTO 2005... Shortcuts no
    ... The code that you've implemented essentially allows you to hook the click ... event of the Paste button, however, using the CTRL+V keyboard shortcut to ... execute the paste would not execute the click event of the Paste menu item ... override the CTRL+V shortcut. ...
    (microsoft.public.vsnet.vstools.office)
  • Re: Intellectual Property Protection
    ... I can just pop up the character map (or any other onscreen keyboard) and type whatever I want. ... It seems to me that what I should do is hook the keyboard, ... and compare it to a database of copyrighted works. ... Blanking one makes the use compliant with the license. ...
    (microsoft.public.development.device.drivers)
  • Re: Hook Api
    ... Here's an implementation of a Keyboard hook. ... Public Function KeyboardProc(ByVal nCode As Long, ... Friend Sub KeyHandler(ByVal nCode As Long, ...
    (microsoft.public.vb.winapi)
  • Re: Hooks
    ... If you've declared the hook procedure as you have, ... the pointer before passing it to SetWindowsHookEx(). ... If you tell us, again, why you are trying to capture all mouse and keyboard ... > write these types of drivers? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: WH_KEYBOARD_LL not capture all key events
    ... > Hello Paul, ... SIP knows the active application. ... so a combination of that plus the global hook to catch a ... >>> the only way to capture all keyboard input events. ...
    (microsoft.public.windowsce.app.development)