怎么在我2000se+delphi7下面写的一个屏保程序在别的机器上都不能运行????

fenzi 2004-04-12 09:47:31
此程序在我的电脑上面可以运行,可是直接拷贝到别的机器上一运行就出错~!啥原因??
部分代码:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, FileCtrl,jpeg, MPlayer,inifiles;

type
TMyScreenSaverForm = class(TForm)
Image1: TImage;
Timer1: TTimer;
FileListBox1: TFileListBox;
Image2: TImage;
MediaPlayer1: TMediaPlayer;
Label1: TLabel;
Timer2: TTimer;
FileListBox2: TFileListBox;
procedure closescr(var Msg:TMsg;var Handled:boolean);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Timer2Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
FormCaption: string;
inifile:tinifile;
public
xx,yy,bz,t,s:integer;
fileext:string[4];
aJpg:TJpegImage;
{ Public declarations }
end;

var
MyScreenSaverForm: TMyScreenSaverForm;

implementation

{$R *.dfm}




procedure tmyscreensaverform.closescr(var msg :tmsg;var handled:boolean);
var x,y:integer;
begin
case msg.message of
WM_LBUTTONDOWN:CLOSE;
WM_MBUTTONDOWN:CLOSE;
WM_RBUTTONDOWN:CLOSE;
WM_KEYDOWN:CLOSE;
WM_KEYUP:CLOSE;
WM_SYSKEYDOWN:CLOSE;
WM_SYSKEYUP:CLOSE;
end;
end;

procedure TMyScreenSaverForm.FormCreate(Sender: TObject);
var filename:string;
begin
filename:=extractfilepath(application.ExeName)+'set.ini';
inifile:=tinifile.Create(filename);
label1.Caption :=inifile.ReadString('set','name',label1.Caption);
inifile.Free;
application.OnMessage :=closescr;
filelistbox1.ApplyFilePath(extractfilepath(application.ExeName)+'\pic') ;
filelistbox2.ApplyFilePath(extractfilepath(application.ExeName)+'\wav');
if (filelistbox1.Count=0)or(filelistbox2.Count=0) then
begin
application.MessageBox('"PIC"目录和"WAV"目录必须先添加图片和音乐文件','提示',mb_iconquestion);
application.Terminate;
end;
randomize;
filelistbox2.ItemIndex:=random(filelistbox2.Count);
mediaplayer1.FileName :=filelistbox2.FileName;
mediaplayer1.Close;
mediaplayer1.Open;
if mediaplayer1.FileName<>'' then
begin
mediaplayer1.Wait :=false;
mediaplayer1.Play ;
end;
ShowCursor(False);
timer1.Enabled :=true;
timer2.Enabled :=true;
end;

procedure TMyScreenSaverForm.Timer1Timer(Sender: TObject);
begin
// ajpg.Free;
randomize;
filelistbox1.ItemIndex:=random(filelistbox1.Count-1);
fileext:=ansiuppercase(ExtractFileExt(FileListBox1.Filename));
if (fileext='.BMP')or(fileext='.ICO')or(fileext='.WMF')or(fileext='.EMF')or(fileext='.gif') then
begin
if (fileext='.BMP') then
begin
image1.Picture.LoadFromFile(filelistbox1.FileName);
end;
if fileext='.ICO' then
begin
image2.Picture.LoadFromFile(filelistbox1.FileName);
image1.Picture.Icon:=image2.Picture.Icon;
end;
if (fileext='.WMF')or(fileext='.EMF') then
begin
image2.Picture.LoadFromFile(filelistbox1.FileName);
image1.Picture.Metafile :=image2.Picture.Metafile ;
end;
if (fileext='.gif') then
begin
end;
end
else
begin
ajpg:=TJpegImage.Create;
ajpg.LoadFromFile(filelistbox1.FileName);
image1.Picture.Assign(ajpg);
end;
end;
...全文
56 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangxingbo 2004-04-12
  • 打赏
  • 举报
回复
你的code可真长 也不知什么错
Little2000 2004-04-12
  • 打赏
  • 举报
回复
出什么错啊?

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧