1、http://www.delphibbs.com/delphibbs/dispq.asp?LID=1750063
标题是: 好玩的一个问题,不响应onkeyDown? (50分)
-------------------------------------转自网络
var
OldWndProc
ointer
function NewWndProc(hWnd: hWnd
Msg: Cardinal
wParam: Cardinal
lParam: Cardinal): LongInt;
begin
Result:=0;
if Msg=WM_KEYDOWN then //在这里处理自己的消息
begin
Exit
//如果此消息不需要Flash处理,直接返回
end;
Result:=CallWindowProc(OldWindowProc,WindowHandle,TheMessage,ParamW,ParamL)
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWndProc:=Pointer(SetWindowLong(Flash.Handle,GWL_WNDPROC,LongInt(@NewWndProc)));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
SetWindowLong(Flash.Handle,GWL_WNDPROC,LongInt(OldWndProc));
end;
2、http://www.delphibbs.com/delphibbs/dispq.asp?LID=1482354
标题是: 全屏播放FLASH时,按ESC键为何关闭不了窗口?代码应该是对的啊! (20分)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
OleCtrls, ShockwaveFlashObjects_TLB;
type
TForm1 = class(TForm)
ShockwaveFlash1: TShockwaveFlash;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure MyOnMessage(var MSG:TMSG;var Handle:Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.MyOnMessage(var MSG: TMSG
var Handle: Boolean);
begin
if ((msg.message=WM_KEYUP) or
(msg.message=WM_KEYDOWN))
and (msg.wParam=VK_Escape) then
begin
handle:=true;
close;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
application.OnMessage:=MyOnMessage;
end;
end.