PDA

View Full Version : SetWindowsHookEx failing with error code 31


fusi
27th March 2008, 01:43 AM
yo

im currently trying to write a small invisible app that runs in the background and converts the keyboards windows key into a ctrl key.

now, when i call SetWindowsHookEx it returns an error code of 31 (0x1f) which as far as i can tell equates to:

"ERROR_GEN_FAILURE - A device attached to the system is not functioning." from msdn.

ive read somewhere about security problems and sdkcerts.cab etc - but if it was a security issue wouldnt it return an error code of 5 (ERROR_ACCESS_DENIED)?

anyone know what i gotta do to get SetWindowsHookEx to succeed? or has it been superceeded by a different api call?

cheers
fusi

fusi
27th March 2008, 01:55 AM
ignore me got it working ^-^

ronzul
25th July 2008, 07:52 AM
Hey fusi

I am getting the same error code when I call SetWindowsHookEx.

Actually, the error occurs on one particular Windows CE device, and the call works on another.

What did you need to do to get this working?

Many thanks
Ronny

truburt
14th August 2008, 08:32 AM
This error appears when SetWindowsHookEx is called when another hook has already been set in the system. Only a single hook at the same time is allowed for Windows Mobile. See http://codekingdom.blogspot.com/2008/03/windows-ce-keyboard-hook-error-31.html for details.