Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as what the inactivity timer does (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702https://stackoverflow.com/a/713519/1030702

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as what the inactivity timer does (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as what the inactivity timer does (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from https://stackoverflow.com/a/713519/1030702

no need to specify the dll's extension
Source Link
Bob
  • 864
  • 6
  • 6

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as what the power off on inactivity timer does (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as the power off on inactivity (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as what the inactivity timer does (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

no need to specify the dll's extension
Source Link
Bob
  • 864
  • 6
  • 6

C# 175 171171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32.dll""user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as the power off on inactivity (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

C# 175 171

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32.dll")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as the power off on inactivity.

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

C# 175 171 167

class P{static void Main(){SendMessage(65535,274,61808,2);}[System.Runtime.InteropServices.DllImport("user32")]static extern int SendMessage(int a,int b,int c,int d);}

A lot of the answers here don't actually make the screen black: on an LCD screen, the backlight remains on and bleeds through, leaving you with a darkish grey.

This little snippet actually tells Windows to turn off the screen, the same as the power off on inactivity (Note: this doesn't violate the "no power off" rule because it really just causes the monitor to go into standby. Most monitors will turn back on when input is resumed. Also, that rule's intention seems to be to make sure the program can turn it back on - see below.)

Move the mouse or press a key to turn the screen back on.

Monitor power off adapted from http://stackoverflow.com/a/713519/1030702

decimal takes less characters than hex
Source Link
Bob
  • 864
  • 6
  • 6
Loading
Source Link
Bob
  • 864
  • 6
  • 6
Loading