Procedure MessageLoop(var Msg:TMsg; var Handled:Boolean);
public
{ Public declarations }
end;
var
fmWebModule: TfmWebModule;
implementation
{$R *.dfm}
Procedure TfmWebModule.MessageLoop(var Msg: TMsg; var Handled: Boolean);
Const
DialogKeys : Set of Byte = [VK_RETURN];
MSJVMClassName = 'MSAWT_Comp_Class'; // for Java Applets
Var
iOIPAO : IOleInPlaceActiveObject;
Dispatch : IDispatch;
Str : String;
begin
// WebBrowser의 도큐멘트 표시 부분의 핸들이 아닌 경우에는 무시
If Msg.hwnd <> FWebHandle then Exit;
If ((Msg.Message = WM_KEYDOWN) or (Msg.Message = WM_KEYUP)) and
(Msg.wParam in DialogKeys) then Begin
Handled:= IsDialogMessage(WebBrowser.Handle, msg) = True;
SetLength(Str, MAX_PATH);
GetClassName(Msg.hwnd, PChar(Str), MAX_PATH);
SetLength (Str, StrLen (PChar(Str)));
if (Msg.wParam = VK_DELETE) and (Str = MSJVMClassName) then
else
if Handled then
if FOleInPlaceActiveObject <> Nil then
FOleInPlaceActiveObject.TranslateAccelerator(Msg)
else
begin
Dispatch := IDispatch(WebBrowser.Application);
if Dispatch <> Nil then
begin
Dispatch.QueryInterface(IID_IOleInPlaceActiveObject, iOIPAO);
if iOIPAO <> Nil then
FOleInPlaceActiveObject := iOIPAO;
end;
end;
End Else Handled:= False;
End;
procedure TfmWebModule.FormCreate(Sender: TObject);
begin
Application.OnMessage:= MessageLoop;
end;
|