C & C++/C & C++

[Tip] 모니터 끄기

izen8 2011. 4. 18. 17:53
// 모니터 끄기
PostMessage( WM_SYSCOMMAND, SC_MONITORPOWER, 2 );
/// SystemParametersInfo()의 Power Parameters를 사용.

// SendMessage()함수를 WM_SYSCOMMAND와 SC_MONITORPOWER 인자를 사용

//MonitorOff
::SendMessage(this->m_hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 1);

//MonitorOn
::SendMessage(this->m_hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1);

{
// Sets the state of the display.
// This command supports devices that have power-saving features,
// such as a battery-powered personal computer.
// The lParam parameter can have the following values:
// 1 - the display is going to low power
// 2 - the display is being shut off

PostMessage( WM_SYSCOMMAND, SC_MONITORPOWER, 2 );