2006. december 29., péntek

Put the monitor into standby mode

Problem/Question/Abstract:

How to put the monitor into standby mode

Answer:

To put the screen into standby mode, use the SendMessage command to send a system command to the API. Send it the appplication handle, message type and the message values. Here we send SC_MonitorPower command type with the value of 1 to turn on screen standy mode. PostMessage can be used with the same parameters. The only difference is that the message is put into a queue. SendMessage causes direct action.

SendMessage(Application.Handle, wm_SysCommand, SC_MonitorPower, 1);

To manually turn the screen back on, send the same command but with the value of -1. Otherwise standby mode will be turned off by the usual actions associated with screen revival.

SendMessage(Application.Handle, wm_SysCommand, SC_MonitorPower, -1);


Nincsenek megjegyzések:

Megjegyzés küldése