UCMESS:Utility to Close Monitor or Enter Screen Saver

时间:2012-07-09 10:27:38
【文件属性】:
文件名称:UCMESS:Utility to Close Monitor or Enter Screen Saver
文件大小:81KB
文件格式:RAR
更新时间:2012-07-09 10:27:38
Close_Monitor Enter_Screen_Saver Utility to Close Monitor or Enter Screen Saver v1.0.0.1 Release Date:2009 06 19 Program Name:UCMESS Author:Lawrence Don E-mail:LawrenceDon@163.com Support Web: lawrencedon.blog.hexun.com 下载地址:http://sites.google.com/site/downloadcenterforldsstudio/Home/UCMESS.rar?attredirects=0 UCMESSc.exe:直接双击该程序将关闭显示器,在CMD窗口中执行该程序时可以加参数cm或ss。 UCMESSc.exe cm 关闭屏幕; UCMESSc.exe ss 进入屏幕保护程序; 可以将CloseMonitor.cmd,EnterScreenSaver.cmd的快捷方式放到桌面,双击CloseMonitor.cmd将关闭显示器,双击EnterScreenSaver.cmd 将进入屏幕保护程序。 UCMESS.exe:直接双击该程序会跳出一窗口,点击"Close Monitor"按钮将关闭显示器,点击"Enter Screen Saver"按钮将进入屏幕保护程序。 文件MD5信息: File name MD5 value UCMESSc.exe 89c43352b6d5db291f810387dcaa5e55 UCMESS.exe 94f65e0a550d76971d1614bdd93cfffe CloseMonitor.cmd 6d7c807cb6291456d45dee7fa4390504 EnterScreenSaver.cmd 37343733f2ed02f05e2a69f201f19394 网上有一个名为CloseMonitor.exe的程序,我在2006年就用到它了,不过一直没关心它的实现原理是什么,最近又用到这个程序的时候,特地将其的 实现原理研究了一下,原来如此简单。 CloseMonitor.exe用的是SendMessage(HWND_BROADCAST,WM_SYSCOMMAND,SC_MONITORPOWER,2),这种写法可能导致程序没法结束并一直留在进程队列中, 因为The SendMessage function 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
【文件预览】:
UCMESSc.exe
UCMESS.exe
ReadMe.txt
CloseMonitor.cmd
EnterScreenSaver.cmd

网友评论

  • 方便关闭屏幕,感谢分享