开发者

Detecting if Windows Login Screen is visible to user in VB.NET

Hey StackOverflow VB.NET members,

After running the following code (which locks the computer), what code must I be applying to see if the user has successfully logged into the computer and tha开发者_JAVA技巧t "Lock Screen" I'd so called has disappeared?

Private Declare Function LockWorkStation Lib "user32.dll" () As Long

Private Function LockComputer()
    LockWorkStation()
End Function

I will call "LockComputer", after that what do I do to see if the Lock screen so called by this function (after say 2 minutes) has disappeared or is still there asking for the password from the user!

Thanks, Akshit Soota


Take a look on this: http://msdn.microsoft.com/en-us/library/aa376875%28v=vs.85%29.aspx

There it says: There is no function you can call to determine whether the workstation is locked.

But:

To receive notification when the user logs in, use the WTSRegisterSessionNotification function to receive WM_WTSSESSION_CHANGE messages. You can use session notifications to track the desktop state so you know whether it is possible to interact with the user.


Did you read this in the MSDN documentation of LockWorkstation API:

There is no function you can call to determine whether the workstation is locked. To receive notification when the user logs in, use the WTSRegisterSessionNotification function to receive WM_WTSSESSION_CHANGE messages.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜