打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
delphi 之 WebBorwser 解决无法模拟Enter
分类: Delphi 2012-02-01 15:00 177人阅读 评论(0) 收藏 举报

原文:http://topic.csdn.net/t/20050525/15/4034712.html

//添加一个TApplicationEvents,然后添加下列事件响应代码:

procedure   TForm1.ApplicationEvents1Message(var   Msg:   tagMSG;
    var   Handled:   Boolean);
{   fixes   the   malfunction   of   some   keys   within   webbrowser   control   }
const
    StdKeys   =   [VK_TAB,   VK_RETURN];   {   standard   keys   }
    ExtKeys   =   [VK_DELETE,   VK_BACK,   VK_LEFT,   VK_RIGHT];   {   extended   keys   }
    fExtended   =   $01000000;   {   extended   key   flag   }
begin
    Handled   :=   False;
    with   Msg   do
        if   ((Message   > =   WM_KEYFIRST)   and   (Message   <=   WM_KEYLAST))   and
            ((wParam   in   StdKeys)   or   {$IFDEF   VER120}(GetKeyState(VK_CONTROL)   <   0)   or   {$ENDIF}
            (wParam   in   ExtKeys)   and   ((lParam   and   fExtended)   =   fExtended))   then
        try
            if   IsChild(WebBrowser1.Handle,   hWnd)   then
            {   handles   all   browser   related   messages   }
            begin
                with   WebBrowser1.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

uses   activex,   OleCtrls......

更多0
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
webbrowser
sql网络服务的编辑器怎么调出来
Delphi
WebBrowser组件和MSHTML 在Delphi中的使用
delphi添加任务栏右键菜单
盒子
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服