::SendMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_MONITORPOWER,2);//关闭
::Sleep(500);
::SendMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_MONITORPOWER,1);//打开
SendMessage的句柄如果为HWND_BROADCAST,If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.