我想锁定当前操作用户的访问,就好像用户
点击开始→指向关机→点击LOCK
如何在 C# 中做到这一点?
http://jessn.blogspot.com/2009/05/lock-my-computer-programatically-in-c.html 这篇文章说得最好:
一个更好的设计,没有硬编码到您的 Windows 系统路径等:
使用 System.Runtime.InteropServices;
[DllImport("user32.dll")] public static extern void LockWorkStation();
然后只需调用 LockWorkStation();
System.Diagnostics.Process.Start("shutdown.exe -l");
it will LOG OFF your computer and now if the account has secure with some password then windows will ask for password otherwise not.