开发者

Windows Message for User Locking Screen

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.

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

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


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

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜