我想锁定当前操作用户的访问权限,就像用户
一样单击开始→指向关闭→单击锁定
如何在C#中做到这一点?
答案 0 :(得分:4)
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();
答案 1 :(得分:0)
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.