unit USplash;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, OleCtrls, ShockwaveFlashObjects_TLB, Buttons;
type
TfrmSplash = class(TForm)
Timer1: TTimer;
flash: TShockwaveFlash;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure mymessage(var msg:tmsg;var handled:boolean);
procedure FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
keepFrm:boolean;
end;
var
frmSplash: TfrmSplash;
implementation
{$R *.dfm}
procedure TfrmSplash.FormCreate(Sender: TObject);
begin
keepFrm:=true;
flash.Movie:='d:/aa.swf';
flash.Loop:=false;
flash.Play;
application.onmessage:=mymessage;
end;
procedure TfrmSplash.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
keepFrm:=false;
end;
procedure TfrmSplash.Timer1Timer(Sender: TObject);
begin
if not flash.Playing then
keepFrm:=false;
end;
procedure TfrmSplash.mymessage(var msg: tmsg;
var handled: boolean);
begin
if (msg.message=wm_rbuttondown) and (msg.hwnd=flash.handle) then
begin
handled:=true;
end;
end;
procedure TfrmSplash.FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin
if key=VK_ESCAPE then
//如果按下ESC键,则马上停止显示窗体
keepFrm:=false;
end;
end.
有一个小问题,所有的消息都通过mymessage处理了,所以提早释放这个窗体将导致
内存错误,我想最好能够将这个消息只是在本窗体使用,但是我不会写,会的告诉我
一声.