mozart90 Posted May 24, 2006 Share Posted May 24, 2006 Hi I have found a code snippet from VB turning off/on the monitor. But I can't figure out to translate it in an correct dll call. Here ist the VB Code: Private Declare Function SendMessage Lib "user32" Alias _ "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As _ Long, ByVal wParam As Long, lParam As Any) As Long Const WM_SYSCOMMAND = &H112& Const SC_MONITORPOWER = &HF170& 'turn off SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 2& 'turn on SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal -1& I tried this in autoit .... (of course not working) $WM_SYSCOMMAND = '&H112&' $SC_MONITORPOWER = '&HF170&' ; turn off dllcall('user32','int','SendmessageA','long',$WM_SYSCOMMAND,'int', $SC_MONITORPOWER, 2) sleep(10000) ; turn on dllcall('user32','int','SendmessageA','long',$WM_SYSCOMMAND,'int', $SC_MONITORPOWER, -1) has anybody experiences with? greetings mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
Micha1405 Posted May 24, 2006 Share Posted May 24, 2006 i found it in this forum ;MsgBox(0, "Started", @ScriptName & " has started.... F11 = Monitor off, F10 = Monitor on, Esc = Exit Program.") #NoTrayIcon Opt("TrayMenuMode",1) Opt ("WinTitleMatchMode", 4) HotKeySet("{F11}", "MonOff") HotKeySet("{F10}", "MonOn") HotKeySet("{Esc}", "Close") While 1 Sleep(0x7fffffff) WEnd Func Close() $hwnd = WinGetHandle('classname=Progman') DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', 274, 'int', 61808, 'int', -1) MsgBox(0, "Closing...", "Closing program.....") Exit EndFunc;==>Close Func MonOn() $hwnd = WinGetHandle('classname=Progman') DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', 274, 'int', 61808, 'int', -1) EndFunc;==>MonOn Func MonOff() $hwnd = WinGetHandle('classname=Progman') Sleep(500) DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', 274, 'int', 61808, 'int', 2) EndFunc;==>MonOff My TrayToolBar Link to comment Share on other sites More sharing options...
mozart90 Posted May 24, 2006 Author Share Posted May 24, 2006 ... thx I didn't found this ... Greetings mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
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