This commit is contained in:
Serge
2024-04-01 14:22:29 +02:00
parent 351566e24a
commit 3fc5d6a124
5 changed files with 26 additions and 0 deletions

View File

@@ -32,6 +32,15 @@ public class NativeMethods
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern uint FormatMessage(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, out string lpBuffer, uint nSize, IntPtr Arguments);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool LockWorkStation();
public static void LockScreen()
{
LockWorkStation();
}
public static void TurnOffScreen()
{
Form f = new Form();