Discussion:
Keyboard hook from Windows Service
(too old to reply)
p***@gmail.com
17 years ago
Permalink
Hi,
I am trying to write a service to hook the keyboard. I am using
SetWindowsHookEx for the same.
The actual keyboard hook is in a DLL. I am able to set the hook
without any error, but still I am not able get call to my callback
routines.

Same hooking works as expected when done through a normal windows
application, but it fails for service.

Can someone give some pointers on how should I go ahead to hook a
keyboard through service.

Thanks in advance.

Pushkar
Volodymyr M. Shcherbyna
17 years ago
Permalink
When you set up a system wide hook, the callback _from dll_ get's called.
The dll is mapped into each process, and the hook procedure is executed in
the context of the process. So why do you try to use in windows services on
a first place? What are you trying to achieve?
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
Post by p***@gmail.com
Hi,
I am trying to write a service to hook the keyboard. I am using
SetWindowsHookEx for the same.
The actual keyboard hook is in a DLL. I am able to set the hook
without any error, but still I am not able get call to my callback
routines.
Same hooking works as expected when done through a normal windows
application, but it fails for service.
Can someone give some pointers on how should I go ahead to hook a
keyboard through service.
Thanks in advance.
Pushkar
p***@gmail.com
17 years ago
Permalink
On Mar 20, 3:04 pm, "Volodymyr M. Shcherbyna"
...
Hi,
I would like to execute SetWindowsHookEx without user intervention, so
I am trying though windows.
My use case is to hook the keyboard, but I don't want to deploy any
windows application.
If you have any other alternative, please do suggest it.

Thanks,
Pushkar
Gary Chanson
17 years ago
Permalink
Post by p***@gmail.com
Hi,
I would like to execute SetWindowsHookEx without user intervention, so
I am trying though windows.
My use case is to hook the keyboard, but I don't want to deploy any
windows application.
If you have any other alternative, please do suggest it.
SetWindowsHookEx doesn't require any windows owned by the caller, but if
you need them for any other purpose you can create hidden windows or visible
windows off the edge of the display.
--
- Gary Chanson (Windows SDK MVP)
- Abolish Public Schools
Continue reading on narkive:
Loading...