国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

定制 WebBrowser 控件

2024-07-21 02:24:09
字體:
供稿:網(wǎng)友
因為工作需要,這幾天在尋找定制 webbrowser 控件的方法。原來已經(jīng)研究過一陣子,原理大概知道,
基本就是實現(xiàn) idochostuihandler 和 idochostshowui 兩個接口,ie 控件會在適當?shù)臅r候調(diào)用這兩個接口,
我只要按照幫助文檔的說明設置不同的值就可以了。

掛接這兩個接口接口到控件中去,有兩種方法:
一種是通過 icustomdoc 接口定制,代碼如下:
html0.navigate2("about:blank");
icustomdoc o = html0.document as icustomdoc;
o.setuihandler(this as idochostuihandler);
但是因為只有文檔裝入之后才可以取得document的值,所以需要預先裝入一個空文檔,這里是about:blank。

第二種方法是完成 active document host 所需要的所有接口
, ioleclientsite
, ioleinplacesite
, ioledocumentsite
//, iolewindow // ioleinplacesite 已經(jīng)包含了該接口
, idochostuihandler
, idochostshowui

// ioleinplacesite.getwindowcontext 調(diào)用需要以下兩個接口
, ioleinplaceframe
//, ioleinplaceuiwindow // ioleinplaceframe 已經(jīng)實現(xiàn)了該接口

// 接口 ioleclientsite.getcontainor 需要用到
, iolecontainer

掛接這些接口到控件中的代碼如下:
ioleobject o = html0.getocx() as ioleobject;
o.setclientsite(this as ioleclientsite);
一旦掛接成功之后,一般會調(diào)用如下幾個函數(shù)
ioleinplacesite getwindow
idochostuihandler gethostinfo
idochostuihandler getoptionkeypath
idochostuihandler gethostinfo
idochostuihandler getdroptarget
idochostuihandler updateui
idochostuihandler showui
idochostuihandler hideui
idochostuihandler translateaccelerator
idochostuihandler translateurl
idochostuihandler showcontextmenu
idochostshowui idochostshowui
ioleclientsite getcontainer

另外還有一種方法,就是直接使用文檔嵌入功能,嵌入 htmldocument 對象,這樣可以省卻使用 webbrowser 控件。htmleditor 就是用的這種方法,可惜我沒能做成。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 民权县| 苍梧县| 洛宁县| 杭锦后旗| 凤翔县| 扬州市| 鄢陵县| 阿城市| 黄骅市| 长垣县| 通化市| 贵溪市| 榆树市| 广东省| 东源县| 渝北区| 资中县| 扶绥县| 富源县| 桂平市| 左云县| 乌什县| 东至县| 淮阳县| 苍梧县| 日喀则市| 邵阳县| 陆良县| 雷山县| 犍为县| 遂溪县| 沾益县| 赤城县| 正定县| 西安市| 满洲里市| 福鼎市| 乐至县| 白河县| 酒泉市| 灵寿县|