Click here to Skip to main content
15,884,473 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
Posted

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
 
Comments
CPallini 1-Dec-15 7:28am    
5.
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.
—SA
Kornfeld Eliyahu Peter 1-Dec-15 14:50pm    
Thank you!
C#
[DllImport("user32")]
public static extern void LockWorkStation();

Usage: 

  LockWorkStation();
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Dec-15 14:45pm    
Sure, a 5.
—SA

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