利用C#锁定计算机

using System.Runtime.InteropServices;
 
[DllImport("User32.DLL")]
public static extern void LockWorkStation();   

private void button1_Click(object sender, EventArgs e)

      LockWorkStation();
}
原文地址:https://www.cnblogs.com/lxcsmallcity/p/1580767.html