I would like to program code in EXcel2003 VBA to turn on or off my monitor in my window XP
computer and I tried the code in the link, http://www.expertsexchange.com/Programming/Misc/Q_20840222.html
and set lparm in sendmessage API function from 1 or 2, But it doesn't have any response on
my monitor, Why ? lparm=2 is setting to turn off and 1 is setting for turn-on
Is it hwnd handle that can be any window's handle in attached VBA code ? or other setting I need
to set for hwnd input in oder to turn on or off monitor ?
ANd it doesn't work , is it because my montherboard not supporting the function ?
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
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MONITORPOWER = &HF170
Dim hwnd As Long
hwnd = GetForegroundWindow()
Call SendMessage(hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2)