我贴的在2000下没有问题。SC_MONITORPOWER 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 power2 - the display is being shut offMinimum DLL Version None Header Declared in Winuser.h, include Windows.h Minimum operating systems Windows 95, Windows NT 3.1 看msdn意思是win95,nt31以上都是可以的,你自己验证一下
SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);//打开显示器
至于定时不用我说了吧!!!!
window2000server 测试不行吧,我用的是D6
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
// turn it on again:
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1); 试下上面的,应该可以的
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);//关闭SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);//打开
关闭显示器
//WIN98
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);
//WINNT
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 1);唤醒
SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
SendMessage(Application.Handle, 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 power2 - the display is being shut offMinimum DLL Version None
Header Declared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1 看msdn意思是win95,nt31以上都是可以的,你自己验证一下
d6+winXP下通过!
{
if ( GetVersion() < 0x80000000 )
{
TOKEN_PRIVILEGES tp;
HANDLE hToken;
LUID luid; LPTSTR MachineName = NULL; // pointer to machine name
if(! OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken )) return;
if(! LookupPrivilegeValue(MachineName, SE_SHUTDOWN_NAME, &luid)) return; tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL );
}
SetSystemPowerState(false, false); // 休眠的关键
// SetSuspendState
}
不是你自己发消息就实现该功能的