Windows服务 [英] Windows Service

查看:80
本文介绍了Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


可以在C#

Windows服务中实现SetWindowsHookEx和全局键盘钩子吗?我可以将打印屏幕密钥陷入普通的窗口

应用程序,但是当我设置

它作为Windows时,相同的代码根本无法按下按键服务。该服务编译和注册罚款...


谢谢,

John

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

推荐答案




< DIV>& quot; John F& quot; &安培; LT; jf@rt.com& GT;在消息中写道

新闻:C9 ********************************** @ microsof t.com ...< / DIV> Hello All,


<DIV>&quot;John F&quot; &lt;jf@rt.com&gt; wrote in message
news:C9**********************************@microsof t.com...</DIV>Hello All,

>

可以实现SetWindowsHookEx和全局键盘钩子一个C#

Windows服务?我可以将打印屏幕按键陷入常规窗口

应用程序,但是相同的代码根本无法按下按键时我设置

设置

它作为Windows服务。该服务编译并注册正常...
>
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...



全局钩子的范围是Windows桌面,而服务有一个单独的

桌面。


David

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

David


服务通常有自己的桌面,与用户不同。

您是否尝试过设置允许与桌面互动?

服务属性中的选项?我认为这可能会在控制台桌面上运行它。

过程。

Ciaran O'Donnell


John F写道:
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,


SetWindowsHookEx和全局键盘钩子可以用C#实现$

Windows服务?我可以将打印屏幕密钥陷入普通的窗口

应用程序,但是当我设置

它作为Windows时,相同的代码根本无法按下按键服务。该服务编译和注册罚款...


谢谢,

John
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


这篇关于Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆