procedure TForm1.IEMessageHandler(var Msg: TMsg; var Handled: Boolean);
const
StdKeys = [VK_TAB, VK_RETURN]; { 标准键 }
ExtKeys = [VK_DELETE, VK_BACK, VK_LEFT, VK_RIGHT]; { 扩展键 }
fExtended = $01000000; { 扩展键标志 }
begin
Handled := False;
with Msg do
if ((Message >= WM_KEYFIRST) and (Message <= WM_KEYLAST)) and
((wParam in StdKeys) or (GetKeyState(VK_CONTROL) < 0) or
(wParam in ExtKeys) and ((lParam and fExtended) = fExtended)) then
try
if IsChild((PageControl1.ActivePage.Controls[0] as TWebBrowser).Handle, hWnd) then
{ 处理所有的浏览器相关消息 }
begin
with (PageControl1.ActivePage.Controls[0] as TWebBrowser).Application as IOleInPlaceActiveObject do
Handled := TranslateAccelerator(Msg) = S_OK;
if not Handled then
begin
Handled := True;
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;
except
end;
end; // IEMessageHandler