这是电脑爱好者上的一个FLASH播放器的程序.全屏后,我按ESC键没有用.还请您指点一下.
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls, ShellCtrls, OleCtrls,
ShockwaveFlashObjects_TLB, ToolWin, ImgList;
type
TForm1 = class(TForm)
ShellTreeView1: TShellTreeView;
Splitter1: TSplitter;
ShockwaveFlash1: TShockwaveFlash;
ImageList1: TImageList;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
procedure ShellTreeView1AddFolder(Sender: TObject;
AFolder: TShellFolder
var CanAdd: Boolean);
procedure ShellTreeView1Change(Sender: TObject
Node: TTreeNode);
procedure FormResize(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
procedure WMSysCommand(var Msg:TWMSysCommand);message WM_SYSCOMMAND;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ShellTreeView1AddFolder(Sender: TObject;
AFolder: TShellFolder
var CanAdd: Boolean);
begin
if not AFolder.IsFolder then
if UpperCase(ExtractFileExt(AFolder.PathName))<>'.SWF' then
CanAdd:=False;
end;
procedure TForm1.ShellTreeView1Change(Sender: TObject
Node: TTreeNode);
begin
if not ShellTreeView1.SelectedFolder.IsFolder then
begin
if Uppercase(ExtractFileExt(ShellTreeView1.selectedFolder.PathName))='.SWF' then
begin
ShockWaveFlash1.BGColor:='-1';
ShockWaveFlash1.Movie:=ShellTreeView1.SelectedFolder.PathName;
ToolButton1.Enabled:=True;
end
else
ToolButton1.Enabled:=false
end
else
ToolButton1.Enabled:=False;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Activecontrol:=nil;
ActiveControl:=ShockWaveFlash1;
end;
procedure TForm1.ToolButton1Click(Sender: TObject);
var
FilePathName:string;
Bitmap:TBitmap;
i:integer;
begin
FilePathName:=ShellTreeView1.SelectedFolder.PathName;
Bitmap:=TBitmap.Create;
try
Bitmap.Width:=ShockWaveFlash1.Width;
Bitmap.Height:=ShockWaveFlash1.Height;
ShockWaveFlash1.PaintTo(Bitmap.Canvas.Handle,0,0);
i:=0;
while (FileExists(FilePathName+intToStr(i)+'.bmp')) do
inc(i);
Bitmap.SaveToFile(FilePathName+intToStr(i)+'.bmp');
finally
Bitmap.Free;
end;
end;
procedure TForm1.ToolButton2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
if (Msg.CmdType=SC_MAXIMIZE) then
begin
SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) and not WS_CAPTION);
ShellTreeView1.Visible:=False;
ToolBar1.Visible:=False;
Splitter1.Visible:=False;
self.WindowState:=wsMaximized;
end
else
DefaultHandler(Msg);
end
procedure TForm1.FormKeyDown(Sender: TObject
var Key: Word;
Shift: TShiftState);
begin
if Key=VK_ESCAPE then
begin
Showmessage('ok');
SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) or WS_CAPTION);
Splitter1.Visible:=True;
ShellTreeView1.Visible:=True;
ToolBar1.Visible:=True;
self.WindowState:=wsNormal;
end;
end;
end