azopardo Posted January 13, 2010 Posted January 13, 2010 Hi, I´m trying to use this code in Windows 7 but is not working. Does anybody know if WM_SYSCOMMAND and SC_MONITORPOWER are still supported in Win7? In case is not, what are the replacemente for this functions? thanks in advance #include <SendMessage.au3> _Main() Func _Main() Local Const $Off = 2, $On = -1 Opt("WinTitleMatchMode", 4) $hwnd = WinGetHandle('classname=Progman') _ToggleMonitor($hWnd, $Off) Sleep ( 3000 ) _ToggleMonitor($hWnd, $On) EndFunc Func _ToggleMonitor($hwnd, $OnOff) Local Const $WM_SYSCOMMAND = 274 Local Const $SC_MONITORPOWER = 61808 _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff) If @error Then MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error) Exit EndIf EndFunc
KaFu Posted January 13, 2010 Posted January 13, 2010 Works for me. Maybe something UAC related? Are you testing with an admin account? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
azopardo Posted January 13, 2010 Author Posted January 13, 2010 Works for me. Maybe something UAC related? Are you testing with an admin account?Thanks KaFu, I will try again
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