Windows Service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,

Can SetWindowsHookEx and a global keyboard hook be implemented in a C#
Windows Service? I can trap the print screen key in a regular windows
application, but the same code simply doesn't catch the key press when I set
it up as a Windows Service. The service compiles and registers fine...

Thanks,
John
 
Can SetWindowsHookEx and a global keyboard hook be implemented in a C#
Windows Service? I can trap the print screen key in a regular windows
application, but the same code simply doesn't catch the key press when I
set
it up as a Windows Service. The service compiles and registers fine...

A global hook is scoped to a windows desktop, and Services have a separate
desktop.

David
 
Services normally have their own desktop which is not the same as the users.
Have you tried setting the "Allow interaction with the desktop" option in the
service properties? I think this may well run it in the console desktop
process.

Ciaran O'Donnell
 
Back
Top