//Turns monitor off for ~10 seconds then turns back on.
//LogicKills -> Codecall
#include <windows.h>
#include <ctime>
int main()
{
int seconds = 10;
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;
}
11 replies to this topic
#1
Posted 01 October 2008 - 06:13 PM
http://logickills.org
Science - Math - Hacking - Tech
Science - Math - Hacking - Tech
|
|
|
#2
Guest_Jordan_*
Posted 02 October 2008 - 06:43 AM
Guest_Jordan_*
Nice code snippet Logic! You could convert that to allow the user to pass the amount of time he/she wants the monitor off as the first argument. This would be useful in a network environment where people want to reduce the amount of electricity their computers use. I say network because the administrators could remotely turn off all monitors for xxx amount of time after the work day is over.
#3
Posted 02 October 2008 - 07:31 AM
Über cool :P I sure will use this one
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#4
Posted 03 October 2008 - 03:29 AM
I might actually have a use for this! thanks :D
#5
Posted 06 October 2008 - 04:51 AM
Uh-oh, your code seems to only work for win95.. (Or was it 98?) Reference: MSDN..
It didn't work with my computer :(
It didn't work with my computer :(
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#6
Posted 06 October 2008 - 12:46 PM
marwex89 said:
Uh-oh, your code seems to only work for win95.. (Or was it 98?) Reference: MSDN..
It didn't work with my computer :(
It didn't work with my computer :(
Um..
It works on XP.. Vista.. Me..
So.. I think you did something wrong lol
http://logickills.org
Science - Math - Hacking - Tech
Science - Math - Hacking - Tech
#7
Posted 06 October 2008 - 12:49 PM
No way :)
I use XP pro, SP3.. Perhaps it's my power settings? My monitor? Anyway.. I could test it on some other computer, though.
I use XP pro, SP3.. Perhaps it's my power settings? My monitor? Anyway.. I could test it on some other computer, though.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#8
Posted 06 October 2008 - 01:46 PM
i like it dude .. thnx a lot :D
#9
Posted 07 October 2008 - 03:54 PM
Just for kicks what kind of monitor do you have?
http://logickills.org
Science - Math - Hacking - Tech
Science - Math - Hacking - Tech
#10
Posted 08 October 2008 - 03:24 AM
I have a 22'' ASUS widescreen... Dunno the exact name, should I look it up, you think?
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#11
Posted 28 January 2011 - 04:40 PM
Works perfectly for me, thanks. Gives me a few ideas :P
#12
Posted 25 March 2011 - 11:56 PM
can you tell me why parameter clock_t don't declare?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top










