Welcome, guest | Sign In | My Account | Store | Cart

Monitor On/Off

C++, 17 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
// Turns monitor off for ~10 seconds then turns back on
// LogicKills 
// Have Fun and head over to logickills.org for new code~
#include <windows.h>
#include <ctime>

int main()
{
 
  int seconds = 20;
  clock_t delay = seconds *CLOCKS_PER_SEC;
  clock_t start = clock();
  while(clock() - start < delay){
  SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);}
  SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
    return 0;
}

Monitor On/Off

Created by kjahdksadsahd ahdsahdand on Thu, 14 May 2009 (MIT)
C++ recipes (21)
kjahdksadsahd ahdsahdand's recipes (1)

Required Modules

  • (none specified)

Other Information and Tasks