Look(0分)

  • 主题发起人 主题发起人 Keyes
  • 开始时间 开始时间
K

Keyes

Unregistered / Unconfirmed
GUEST, unregistred user!
I use this to start screensaver!!!!!!<br>--------------------<br>program ScrStart;<br>uses<br>&nbsp; windows;<br>var handle:integer;<br>begin<br>handle:=findwindow('shell_traywnd',nil);<br>SendMessage(handle,WM_SYSCOMMAND,SC_SCREENSAVE,0);<br>end.<br>--------------------<br>how to show a message when user have not set a screen saver!!!!<br>(i don't want to access registry!)<br>can i get it from the return value of sendmessage(...)?
 
你这样调用screen saver我还是头一次见到,什么原理?<br>shell_traywnd应该是system tray所在的那个小区域,就是"时间"所在<br>的那个地方,和屏幕保护有什么关系?
 
to cAkk<br>调用screensaver只需要给任一窗口<br>SendMessage(handle,WM_SYSCOMMAND,SC_SCREENSAVE,0{试试1,好玩椰});<br>但是我的程序没有消息处理,所以就随便找了一个总是存在的窗口.<br>让他来处理这个消息.<br>同样:<br>关闭显示器: <br>SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 0);<br>打开显示器:<br>SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, -1);<br>可能只要是wm-syscommand消息随便发给谁无所谓!!!!<br><br><br>
 
哦!<br><br>这个也可以上那个"一行解决"了. :-)
 
如果运行正常, 应该是返回0.
 
还是用registry吧.<br>if [HKEY_USERS/.DEFAULT/Control Panel/desktop].screensaveactive.asstring='0' then<br>&nbsp; showmessage('...')<br>else <br>&nbsp; sendmessage(....<br><br><br>你的分呢? &nbsp;:(
 
如果可以用注册表,我早就写出答案了.<br>人家不让用注册表呀!
 
呵呵, 用system.ini行不行:-)
 
sendmessage(...)的返回值都是0呀!!!!
 
var aBool:Boolean;<br><br>SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,0,@aBool,0);<br><br>when user have not set a screen saver,aBool:=False;<br>else aBool:=True;
 
没注意! :(<br><br>不过,为什么不能用registry呢?
 
在大家的帮助下,一个不到20K的小程序就好了!<br>简单方便!<br>------<br>program ScrStart;<br><br>uses<br>&nbsp; windows;<br>{$R *.res}<br>var handle:integer;aBool:Boolean;<br>begin<br>SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,0,@aBool,0);<br>if aBool then begin<br>handle:=findwindow('shell_traywnd',nil);<br>SendMessage(handle,$0112,61760,0);<br>exit;<br>end;<br>Messagebox(0,'你没有设定屏幕保护','ScrStart',MB_ICONQUESTION &nbsp;or MB_OK);<br>end.
 
接受答案了.
 

Similar threads

A
回复
0
查看
943
Andreas Hausladen
A
A
回复
0
查看
819
Andreas Hausladen
A
A
回复
0
查看
848
Andreas Hausladen
A
I
回复
0
查看
2K
import
I
后退
顶部