Click here to Skip to main content
15,614,571 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
to go to lock screen where it's asked for Windows user account password

There are two options

1. Hook to the API and call LockWorkStation[^] function
2. Execute this shell command from your code:
rundll32.exe user32.dll, LockWorkStation
Share this answer
CPallini 1-Dec-15 7:28am    
Kornfeld Eliyahu Peter 1-Dec-15 7:30am    
Thank you!
Sergey Alexandrovich Kryukov 1-Dec-15 14:44pm    
Sure, a 5. And #2 can be performed using System.Diagnostics.Process.Start, to be more precise.
Kornfeld Eliyahu Peter 1-Dec-15 14:50pm    
Thank you!
public static extern void LockWorkStation();


Share this answer
Sergey Alexandrovich Kryukov 1-Dec-15 14:45pm    
Sure, a 5.

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