C# 锁定屏幕LockWorkStation是调用windown API中的一个函数
C# 锁定屏幕LockWorkStation――方法/步骤C# 锁定屏幕LockWorkStation 1、
先引用using System.Runtime.InteropServices;
C# 锁定屏幕LockWorkStation 2、
调用 [DllImport("user32.dll")]
C# 锁定屏幕LockWorkStation 3、
定义 private static extern void LockWorkStation();
C# 锁定屏幕LockWorkStation 4、
全部代码
[DllImport("user32.dll")]
private static extern void LockWorkStation();
private void button1_Click(object sender, EventArgs e)
{
LockWorkStation(); //调用LockWorkStation函数
}