Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do you make a windows form to pop after system lock in VB.net
Posted
Comments
CHill60 19-Aug-15 9:43am    
Not entirely clear ... are you trying to detect when someone is trying to lock their PC and replace the Windows functionality with your own?
Sergey Alexandrovich Kryukov 19-Aug-15 11:09am    
I don't think so. You can always add some application-specific functionality just to the application process. I think the question and the reason for asking it are clear enough. Please see Solution 1.
—SA
CHill60 19-Aug-15 12:05pm    
Fair enough - it was the "after" system lock that was confusing me. No where near enough information in the question what ever they meant!
Sergey Alexandrovich Kryukov 19-Aug-15 13:05pm    
Yes, that's confusing, I agree. I the system is locked, no one will see the the popup. :-)
But the inquirer will quickly realize that trying to use the technique, which is all that really matters.
—SA

1 solution

Please use this class: https://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents%28v=vs.110%29.aspx[^].

You will see that if you handle the event Microsoft.Win32.SystemEvents.SessionSwitch, two of the reasons for invocation of this event are Microsoft.Win32.SessionSwitchReason.SessionLock and Microsoft.Win32.SessionSwitchReason.SessionUnlock:
https://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.sessionswitch%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/microsoft.win32.sessionswitchreason%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900