VicTT Posted May 12, 2005 Posted May 12, 2005 const $WM_SYSCommand = 274,$SC_MonitorPower = 61808,$Power_On = -1,$Power_Off = 2 $HWND=WinGetHandle(WinGetTitle("","")) Func MonitorOff() DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_Off) EndFunc Func MonitorOn() DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_On) EndFunc $i=0 while $i<10 $i=$i+1 MonitorOff() Sleep(2000) MonitorOn() WEnd This code should power off the monitor and then power on after 2 seconds..and do this 10 times..anyway..the problem is that, if I move the mouse while or during the power down sequence, it powers back up..Is there a hard-coded solution to this?Such as another function I need to call up?Would a BlockInput(1) be feasible(the only solution)..and another thing..how do I speed things up a bit? Quote Together we might liveDivided we must fall
VicTT Posted May 12, 2005 Author Posted May 12, 2005 Ok..so I modified the code to read const $WM_SYSCommand = 274,$SC_MonitorPower = 61808,$Power_On = -1,$Power_Off = 2 $HWND=WinGetHandle(WinGetTitle("","")) $dll=DllOpen("user32.dll") Func MonitorOff($s) DllCall($dll,"int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_Off) Sleep($s) EndFunc Func MonitorOn($s) DllCall($dll,"int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_On) Sleep($s) EndFunc $i=0 while $i<10 $i=$i+1 MonitorOff(10) MonitorOn(10) wend DllClose($dll); Superflous unless the user somehow overwrites memory addreses and steps out of the loop..:))..Not likely.. Any other way I could optimize this?(The speed is excelent now..) And Input blocking problem still exists.. Quote Together we might liveDivided we must fall
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now