Hookmanager ...如何作为Windows服务运行 [英] Hookmanager ... How to run as a windows service

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

问题描述

关于非常有用的文章...



Regarding the very helpful article ...

Processing Global Mouse and Keyboard Hooks in C#

(< a href =https://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C>使用C#处理全局鼠标和键盘挂钩[ ^ ])



...我需要在Windows服务中运行HookManager,但事件不会触发...任何想法?



我尝试了什么:



它在WinForm-Application中运行完美

(Processing Global Mouse and Keyboard Hooks in C#[^])

... I need to run the HookManager in a windows service, but the events will not firing ... any ideas?

What I have tried:

It runs perfect in a WinForm-Application

推荐答案

您将无法正常工作,因为服务与登录用户有自己独立的桌面用户会话,因此您的服务代码无法访问交互式桌面上的任何内容作为鼠标和键盘事件。它可以在您的应用程序中正常运行,因为您的应用程序在同一用户会话中作为交互式用户运行。
You won't get this working as services have their own separate desktop\user session from the logged in user so your service code can't access anything on the interactive desktop such as mouse and keyboard events. It works fine from your application as your application is running as your interactive user in the same user session.


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

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