服务需要检测工作站是否被锁定,并且屏幕保护程序处于活动状态 [英] Service needs to detect if workstation is locked, and screen saver is active

查看:100
本文介绍了服务需要检测工作站是否被锁定,并且屏幕保护程序处于活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一项服务,该服务需要检测登录到单台计算机上的所有用户的用户状态。具体来说,我想检查一下屏幕保护程序是否处于活动状态以及它们的会话是否被锁定。

I'm working on a service that needs to detect user states for all user(s) logged on to a single machine. Specifically, I want to check to see whether or not the screen saver is active and whether or not their session is locked.

此代码将在系统级服务下运行。 ,并且没有可见的用户界面,因此可能会排除多个选项(捕获WM消息等)。

This code will run under a system-level service, and has no visible UI, so that may rule out several options (trapping WM messages, etc).

除了普通的工作站外,我希望它能正常工作在有多个用户登录的终端服务器上。由于这些要求,我想知道是否需要涉及多个Win32 API。

Aside from normal workstations, I'd like for this to work on terminal servers that have multiple users logged in to it. Due to these requirements I'm wondering if several Win32 APIs will need to be involved.

关于从哪里开始的任何想法?

Any ideas on where to begin?

推荐答案

最直接的方法是在每个用户的会话中运行一个小型应用。此应用程序的每个实例都可以与服务的主要实例进行通信。

The most straightforward way would be to have a small app running in each user's session. Each instance of this app could communicate with the main instance of the service.

Windows尽力使登录会话保持独立-在服务和交互式桌面之间,以及在各个终端服务会话之间进行访问-因此,除非您的应用首先在该会话中运行,否则访问此类有关用户会话的信息将非常棘手。

Windows tries pretty hard to keep logon sessions separate -- both between services and the interactive desktop, and between individual Terminal Services sessions -- so it gets very tricky to access this sort of information about a user's session unless your app is running in that session to begin with.

这篇关于服务需要检测工作站是否被锁定,并且屏幕保护程序处于活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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