如何用delphi编写屏幕保护(50分)

  • 主题发起人 主题发起人 牛龙
  • 开始时间 开始时间

牛龙

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,谢谢
 

我印象中就是一个exe,只不过是接受几个命令行参数,我这好象有例子程序
我找找看,找到给你发过去!

 
谢谢,我的mail地址是goodlife@263.net
 
下面是一个简单的列子:


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
procedure Timer1Timer(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if label1.left > 500 then
begin
label1.left:=24;
label1.top:=8;
label2.left:=499;
label2.top:=8;
image1.top:=328;
image1.left:=16;
end
else
begin
label1.left:=label1.left+30;
label1.top:=label1.top+30;
label2.left:=label2.Left-30;
label2.top:=label2.top+30;
label1.Font.Color:=label1.font.color+150;
label2.font.color:=label2.font.color+131;
image1.Left:=image1.left+30;
image1.top:=image1.top-30;
image1.Visible:=not image1.Visible;
end;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (ssAlt in Shift) and (ssCtrl in Shift)
and (Key=VK_Tab) then application.Terminate;
end;


//屏幕保护程序规定:接收参数s 为运行,接受参数R为设置

program Project1 ;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

begin
if ParamCount>0 then
if pos('s',paramstr(1))>0 then
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;


 
对了,最后将编译的exe文件改名为scr
 
多人接受答案了。
 
后退
顶部