programatically switching the monitor off?



Jan
07-10-2005, 12:46 AM
Hi

I used to use:
SendMessage(Application.Handle, WM_SYSCOMMAND,SC_MONITORPOWER, 0);

to switch the monitor off via my Delphi app. This worked fine for windows
98, but doesn't seem to work for windows xp pro. Can anyone tell me if it
can be done in xp and how?

Thanks
J

Tom Porterfield
07-10-2005, 12:46 AM
Jan wrote:
> Hi
>
> I used to use:
> SendMessage(Application.Handle, WM_SYSCOMMAND,SC_MONITORPOWER, 0);
>
> to switch the monitor off via my Delphi app. This worked fine for windows
> 98, but doesn't seem to work for windows xp pro. Can anyone tell me if it
> can be done in xp and how?

According to the documentation, your last parameter should be 2 to shut the
monitor off, not 0. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardaccelerators/keyboardacceleratorreference/keyboardacceleratormessages/wm_syscommand.asp
for more info.
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.


programatically switching the monitor off?