468,107 Members | 1,267 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

Windows Service

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
Sep 7 '06 #1
2 8332


<DIV>&quot;John F&quot; &lt;jf@rt.com&gt; wrote in message
news:C9**********************************@microsof t.com...</DIV>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...
A global hook is scoped to a windows desktop, and Services have a separate
desktop.

David

Sep 7 '06 #2
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

"John F" wrote:
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
Sep 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Michael Riggio | last post: by
1 post views Thread by Artur Kowalski | last post: by
9 posts views Thread by SP | last post: by
1 post views Thread by Scott Davies | last post: by
reply views Thread by Scott Davies | last post: by
3 posts views Thread by Doug Bailey | last post: by
4 posts views Thread by tshad | last post: by
5 posts views Thread by dm3281 | last post: by
1 post views Thread by =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.