Unfortunately, the code executed by WH_KEYBOARD must reside within a
DLL due to the way that the windows OS accesses the callback. I
don't know any more than that, since the MS docs are light on the
details of exactly *why* that is the case, or what the specific
software requirements are for successful callback execution. There
might be a workaround, there might not.
On Apr 23, 2008, at 4:00 PM, Maxwell C. Xandeco wrote:
Timothy, I have a native app that blocks the keyboard ,but I not have
the source code,I only need to process the data before calling the
next
hook
I found a jna example that blocks the keyboard on:
https://jna.dev.java.net/nonav/issues/showattachment.cgi/11/contribution
.zip
I realized that in this example the type of hook used is
WH_KEYBOARD, on
KeyHook example the type used is WH_KEYBOARD_LL,
i tried the following change:
hhk = lib.SetWindowsHookEx(User32.WH_KEYBOARD, keyboardHook, hMod, 0);
But don't works form me,nothing happens after register the hook.
I think that changing the type WH_KEYBOARD_LL to WH_KEYBOARD solve the
problem, you have some idea of how the type WH_KEYBOARD work in the
example KeyHook.
Thanks....
Maxwell
-----Original Message-----
From: Timothy Wall [mailto:twal...@dev.java.net]
Sent: quarta-feira, 23 de abril de 2008 16:14
To: use...@jna.dev.java.net
Subject: Re: [jna-users] Create a Block hook with jna
Do you have a native example that works? If you're trying something
entirely new and you're not sure how to do it, throwing JNA in the mix
just adds to the uncertainty if you're not already familiar with it.
On Apr 23, 2008, at 12:26 PM, Maxwell C. Xandeco wrote:
Hi,
I need to create a block keyboard hook on windows, i need to receive
the vkCode and validate, if pass i call the next hook, else i ignore
the key.
I tried with the example of svn (KeyHook) but I could not, this
example call the code java after windows proccess, i need to call
before and validate.