UCMESSc.exe:直接双击该程序将关闭显示器,在CMD窗口中执行该程序时可以加参数cm或ss。 UCMESSc.exe cm 关闭屏幕; UCMESSc.exe ss 进入屏幕保护程序; 可以将CloseMonitor.cmd,EnterScreenSaver.cmd的快捷方式放到桌面,双击CloseMonitor.cmd将关闭显示器,双击EnterScreenSaver.cmd 将进入屏幕保护程序。
nction sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.
我用的方法是PostMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_MONITORPOWER,1);PostMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_MONITORPOWER,2) 首先我用了PostMessage的方法,The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message. 该方法被调用之后会马上返回,从而不会 造成程序一直无法结束。另外我两次PostMessage最后的一个参数分别为1和2(1:the display is going to low power; 2:the display is being shut off) 这样基本可以保证大多数的屏幕是可以被关掉的。 另外我添加了一个新的功能:PostMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_SCREENSAVE, 0);即进入屏幕保护程序。 在UCMESS.exe中我用GetSafeHwnd()取代HWND_BROADCAST,这样可以避免有时关屏幕会出现开关好几次的问题。
针对这个程序的问题请访问我的博客lawrencedon.blog.hexun.com,给我留言,或回复我的文章:Utility to Close Monitor or Enter Screen Saver v1.0.0.1