读书人

twebBrowser中响应html的事件,该如何解

发布时间: 2012-02-28 13:06:36 作者: rapoo

twebBrowser中响应html的事件
怎样让HTML中的元素调用delphi中的方法 
谢谢~

[解决办法]
Html中Java脚本调用COM接口

Delphi(Pascal) code
WebBrowser   有一个OnGetExternal事件,在这里实现:    wbBrowser.OnGetExternal   :=   OnGetExternal;...function   TfrmBrowser.OnGetExternal(out   ppDispatch:   IDispatch):   HRESULT;var    FIntf:   TWebBrowserEvent;begin    FIntf   :=   TWebBrowserEvent.Create;    ppDispatch   :=   FIntf;    Result   :=   S_OK;end;...///   Com   Objectuses    ComObj,   ActiveX,   BrowserEx_TLB,   StdVcl;type    TWebBrowserEvent   =   class(TAutoObject,   ISomeIntface)    protected        procedure   Test;   safecall;        function   Get_GetMacAddr:   OleVariant;   safecall;        //   do   something,   implement   ISomeIntface    end 

读书人网 >.NET

热点推荐