如何执行屏幕保护引起的思索(10分)

  • 主题发起人 主题发起人 QQ
  • 开始时间 开始时间
Q

QQ

Unregistered / Unconfirmed
GUEST, unregistred user!
我想让程序执行屏幕保护程序,在API手册中查到为:<br>ScreenSaverProc<br>可是在DELPHI中怎么用?以后遇到DELPHI中没有说明的API怎么办?<br>怎么知道它在哪个DLL中?<br>分数有限,实在抱歉!
 
Hehe, you can use ShellExec to directly call any Screen file:<br>like:<br>"YourScreen.scr" to run it<br>"YourScreen.scr -s" to setup it, :)<br><br>Good Luck!
 
var<br>&nbsp; s:array[0..200] of char;<br>begin<br>&nbsp; GetSystemDirectory(s,190);<br>&nbsp; ShellExecute(handle, pchar('open'), pchar(StrPas(s)+'/星空模拟.scr'), pchar(''), pchar(''), SW_SHOWNORMAL);<br>end;<br>
 
以后遇到DELPHI中没有说明的API怎么办?怎么知道它在哪个DLL中?分数有限,实在抱歉!<br><br>Hehe, DLL can't help you, for itself also know nothing about the<br>function entry's parameters or functionalities. It is the great<br>joke for sareing resource: Who can share this if he even donot<br>know the functionality or parameters?<br><br>Corba or DCom do some good in this. You can find the interface of<br>a running object. So that you can try call it, note you can try<br>at runtime, but do you know the result of calling? So it's a little<br>joke that DLL, :)<br>
 
以后遇到DELPHI中没有说明的API怎么办?怎么知道它在哪个DLL中?分数有限,实在抱歉!<br><br>Hehe, DLL can't help you, for itself also know nothing about the<br>function entry's parameters or functionalities. It is the great<br>joke for sharing resource: Who can use this DLL if he even do not<br>know the functionality or parameters?<br><br>Corba or DCom do some good in this. You can find the interface of<br>a running object. So that you can try call it, note you can try<br>at runtime, but do you know the result of calling? So it's a little<br>joke that DLL, :)<br>
 
Thanks both you!<br>I know the way you teach me. But I want to know How to deckare <br>ScreenSaverProc Function in delphi?<br>I want to call the current screen saver are using!<br>some windows api does not declare in delphi how can i declare them?<br>Now i have point now, just a joke!<br>Please help me!
 
喔, 原来如此, 那么请您访问<br>HKEY_CURRENT_USER/Control Panel/Desktop/SCRNSAVE.EXE<br>所读出的文件名就是当前的屏幕保护, 使用<br>ShellExecute执行之<br><br>如果碰到没有声明的API, 那么您可以或者自己声明成external<br>或者在Delphi的目录中使用grep或者Find, 查找Delphi系统为您提供的声明<br><br>&gt;How to deckare ScreenSaverProc Function in delphi?<br>如果您想自己实现一个屏幕保护, 那么您必须声明并且export,<br>这就像做一个别人为您规定好了接口的DLL.<br>如果您自己调用屏幕保护, 并不需要声明<br><br>如果您自己调用别人做好的DLL, 那也和调用系统API差不多<br>(其实系统API也就是在一些DLL中提供给您的), 您必须把通常用<br>C语言描述的接口翻译成Delphi的Pascal, 很多书上都有介绍啦!<br>关键就是数据类型所占的存储空间要一样大, :)
 
ScreenSaverProc是标准的WIN32 API<br>人间问的是如何在DELPHI中使用!<br>我回去试试!大家继续!
 
&gt;ScreenSaverProc是标准的WIN32 API<br>并不是一个API!!!<br>只是一个约定, 要求编写的屏幕保护程序必须有这个入口,<br>这就像您的所有C程序必须有一个main一样<br><br>
 
Sorry you are right!<br>QQ Give them points not me!
 
对不起,打扰大家了,因为看到熟悉的ScreenSaver,禁不住手痒了。<br><br>标准的Win32 ScreenSaver程序必须严格按照标准编写,详情请看<br>Win32 SDK,而所有基于Win32的标准程序都必须有一个标志为1的<br>不超过25个字符的说明字符串。<br>但是在Win95下,可以采纳不完全按照标准编写的ScreenSaver程序。<br>Control Panel Desktop Applet只是简单的把SCreenSaver的文件<br>名加入列表,只要是基于Windows的程序,把后缀名改为SCR, Windows<br>都不会察觉(作病毒的朋友们有福了),Win95也不分辨程序是否有<br>说明字符串。<br>而在WinNT下,系统严格地区分标准的和非标准的ScreenSaver,对于<br>标准的,系统显示说明其字符串,对于非标准的,系统只是把它的文件<br>名加入列表。<br><br>在95下,可以随便调用ScreenSaver,在NT下,可用GetBinaryType取得<br>程序的类型:如果是SCS_32BIT_BINARY(基于Win32的程序),再用<br>LoadLibraryEx以LOAD_LIBRARY_AS_DATAFILE方式调用,取得HINSTANCE,<br>最后用LoadString取得说明字符串,即可判断其为标准的SCreenSaver。<br>
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
578
import
I
后退
顶部