用户锁定屏幕的Windows消息 [英] Windows Message for User Locking Screen

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

问题描述

我正在使用C ++中的老式Windows编程,我需要在WndProc中捕获一个事件,该事件指示用户已注销或锁定了屏幕.

I'm working with old-school windows programming in C++, and I need to capture an event in my WndProc which indicates that the user has logged off or locked the screen.

更新(感谢David Hefernan),我到处搜索过,但是唯一发现的是WM_ENDSESSION消息-它不处理屏幕锁定事件.

update (thanks David Hefernan) I've searched everywhere, but the only thing I've found is the WM_ENDSESSION message - which does not handle screen lock events.

任何人都知道这是怎么做的吗?我需要通过Windows XP版本将其应用于Windows 2000.

Anyone know what how this is done? I need to apply it to Windows 2000 through Windows XP flavors.

推荐答案

解决方案是 WM_WTSSESSION_CHANGE ,然后在您的WndProc中进行响应.

The solution is to register for the WM_WTSSESSION_CHANGE and respond to it in your WndProc.

根据WM_WTSSESSION_CHANGE的文档,支持的最低操作系统为XP.现在,由于不再支持Windows 2000,该文档通常说XP是最低要求,而实际上该功能在较早版本中可用.在这种情况下,快速的网络搜索表明您可能会感到失望.

According to the documentation of WM_WTSSESSION_CHANGE, the minimum supported OS is XP. Now, the since Windows 2000 is no longer supported, the documentation often says XP is the minumum when in fact the functionality is available on earlier versions. In this case, a quick web search suggests that you may be disappointed.

要获得有关会话注销(而不是屏幕锁定)的通知,您应该能够使用

To be notified about session logoff (rather then the screen lock), you should be able to use the lParam value of the WM_ENDSESSION message. Look for the presence of the ENDSESSION_LOGOFF flag.

这篇关于用户锁定屏幕的Windows消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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