<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識(shí)百科 - 正文

        如何:在ActiveX控件中獲得頂層IWebBrowser2接口

        來源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-09 08:31:54
        文檔

        如何:在ActiveX控件中獲得頂層IWebBrowser2接口

        如何:在ActiveX控件中獲得頂層IWebBrowser2接口:此文章的信息應(yīng)用于: Microsoft Internet Explorer (編程) 版本4.0, 4.01, 4.01 SP1, 4.01 SP2, 5, 5.01, 5.5 轉(zhuǎn)者注:http://support.microsoft.com/default.aspxscid=kb;en-us;Q257717 概要 微軟知識(shí)庫文章 Q17
        推薦度:
        導(dǎo)讀如何:在ActiveX控件中獲得頂層IWebBrowser2接口:此文章的信息應(yīng)用于: Microsoft Internet Explorer (編程) 版本4.0, 4.01, 4.01 SP1, 4.01 SP2, 5, 5.01, 5.5 轉(zhuǎn)者注:http://support.microsoft.com/default.aspxscid=kb;en-us;Q257717 概要 微軟知識(shí)庫文章 Q17

        說明了如何在控件中獲得所在窗口的IWebBrowser2的引用。但是,開發(fā)者實(shí)際上經(jīng)常需要的是飽含框架集的頂層IWebBrowser2的引用。例如,當(dāng)你在網(wǎng)頁載入之前調(diào)用statusText() 命令設(shè)置狀態(tài)欄的值時(shí)可以用到。因?yàn)檫@個(gè)屬性對WebBrowser控件無效,所以調(diào)用所在框架的IWebBrowser2的函數(shù)會(huì)產(chǎn)生錯(cuò)誤。

        更多信息

        為獲得頂層IWebBrowser2 引用, 從客戶站點(diǎn)獲取IServiceProvider 并且 執(zhí)行一個(gè)QueryService 操作獲取IID_IServiceProvider服務(wù)SID_STopLevelBrowser (在Shlguid.h中定義)。對第二個(gè)IServiceProvider,執(zhí)行一個(gè)QueryService 獲取IID_IWebBrowser2 服務(wù)SID_SWebBrowserApp.

        干這個(gè)的最好的地方是在IOleObject的SetClientSite() 方法里面:

        #include 
        
        #define COMRELEASE(ptr)/
        	if (ptr != NULL) {/
        	ptr->Release();/
        	ptr = NULL;/
        	}
        
        IWebBrowser2 *browser = NULL;
        
        STDMETHODIMP SetClientSite(IOleClientSite *pClientSite)
        {
        	HRESULT hr = S_OK;
        	IServiceProvider *isp, *isp2 = NULL;
        	if (!pClientSite)
        	{
        	COMRELEASE(browser);
        	}
        	else
        	{
        	hr = pClientSite->QueryInterface(IID_IServiceProvider, reinterpret_cast(&isp));
        	if (FAILED(hr))
        	{
        	hr = S_OK;
        	goto cleanup;
        	}
        	hr = isp->QueryService(SID_STopLevelBrowser, IID_IServiceProvider, reinterpret_cast(&isp2));
        	if (FAILED(hr))
        	{
        	hr = S_OK;
        	goto cleanup;
        	}
        	hr = isp2->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2, reinterpret_cast(&browser));
        	if (FAILED(hr))
        	{
        	hr = S_OK;
        	goto cleanup;
        	}
        	cleanup:
        	// Free resources.
        	COMRELEASE(isp);
        	COMRELEASE(isp2);
        	return hr;
        	}
        } 

        參考

        要更多信息,單擊下面的文檔編號查看微軟知識(shí)庫中的文章

        Q172763 信息: 在ActiveX中訪問對象模型

        要更多關(guān)于開發(fā)基于Web的Internet Explorer解決方案,請?jiān)L問下列站點(diǎn):

        http://msdn.microsoft.com/workshop/entry.asp

        http://msdn.microsoft.com/ie/

        http://support.microsoft.com/highlights/iep.asp?FR=0&SD=MSDN

        © 微軟公司 2000,保留所有權(quán)利

        微軟公司的Jay Andrew Allen 投稿

        額外的查詢關(guān)鍵字:IServiceProvider SID_STopLevelBrowser IWebBrowser2

        關(guān)鍵字: kbActiveX kbCtrl kbIE kbIE400 kbGrpDSInet kbie500 kbDSupport kbie501 kbie550
        文章類型 : kbhowto
        技術(shù) : kbIEsearch kbAudDeveloper kbSDKIESearch kbIE500Search kbSDKIE400 kbSDKIE401 kbSDKIE401SP1 kbSDKIE401SP2 kbSDKIE500 kbSDKIE501 kbSDKIE550 kbIE550Search

        How To Retrieve the Top-Level IWebBrowser2 Interface from an ActiveX Control

        2006/3/27 19:25:36

        P {margin:0px;padding:0px;} body {font-size:10pt;font-family:Tahoma;}

        http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257717

        How To Retrieve the Top-Level IWebBrowser2 Interface from an ActiveX Control

        View products that this article applies to.

        Article ID : 257717
        Last Review : September 1, 2005
        Revision : 2.2

        This article was previously published under Q257717

        SUMMARY

        The Microsoft Knowledge Base article

        172763 (http://support.microsoft.com/kb/172763/EN-US/) INFO: Accessing the Object Model from Within an ActiveX Control

        explains how to obtain the IWebBrowser2 reference for the host window of an ActiveX control. However, often what developers actually want is a reference to the topmost IWebBrowser2, the one containing the frameset itself. This can be useful if you want to call the statusText() command, for example, to set the value of the window status box before the page has been loaded. Because this property does not function on the WebBrowser control, calling it from the IWebBrowser2 of the embedded frame results in an error.

        MORE INFORMATION

        To retrieve the top-level IWebBrowser2 reference, get IServiceProvider from the client site and perform a QueryService for IID_IServiceProvider under the service SID_STopLevelBrowser (defined in Shlguid.h). From this second IServiceProvider, perform a QueryService for IID_IWebBrowser2 in the SID_SWebBrowserApp service.

        The best place to perform this work is in the SetClientSite() method of IOleObject:

        #include

        #define COMRELEASE(ptr)/
        if (ptr != NULL) {/
        ptr->Release();/
        ptr = NULL;/
        }

        IWebBrowser2 *browser = NULL;

        STDMETHODIMP SetClientSite(IOleClientSite *pClientSite)
        {
        HRESULT hr = S_OK;
        IServiceProvider *isp, *isp2 = NULL;
        if (!pClientSite)
        {
        COMRELEASE(browser);
        }
        else
        {
        hr = pClientSite->QueryInterface(IID_IServiceProvider, reinterpret_cast(&isp));
        if (FAILED(hr))
        {
        hr = S_OK;
        goto cleanup;
        }
        hr = isp->QueryService(SID_STopLevelBrowser, IID_IServiceProvider, reinterpret_cast(&isp2));
        if (FAILED(hr))
        {
        hr = S_OK;
        goto cleanup;
        }
        hr = isp2->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2, reinterpret_cast(&browser));
        if (FAILED(hr))
        {
        hr = S_OK;
        goto cleanup;
        }
        cleanup:
        // Free resources.
        COMRELEASE(isp);
        COMRELEASE(isp2);
        return hr;
        }
        }

        REFERENCES

        For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

        172763 (http://support.microsoft.com/kb/172763/EN-US/) INFO: Accessing the Object Model from Within an ActiveX Control

        For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

        http://msdn.microsoft.com/library/default.asp?url=/workshop/entry.asp (http://msdn.microsoft.com/library/default.asp?url=/workshop/entry.asp)

        http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/)

        http://support.microsoft.com/iep (http://support.microsoft.com/iep)


        APPLIES TO
        Microsoft Internet Explorer 4.0 128-Bit Edition
        Microsoft Internet Explorer 4.01 Service Pack 2
        Microsoft Internet Explorer 4.01 Service Pack 1
        Microsoft Internet Explorer 4.01 Service Pack 2
        Microsoft Internet Explorer 5.0
        Microsoft Internet Explorer 2.1
        Microsoft Internet Explorer 2.01

        Back to the top

        Keywords:
        kbhowto kbctrl KB257717

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        如何:在ActiveX控件中獲得頂層IWebBrowser2接口

        如何:在ActiveX控件中獲得頂層IWebBrowser2接口:此文章的信息應(yīng)用于: Microsoft Internet Explorer (編程) 版本4.0, 4.01, 4.01 SP1, 4.01 SP2, 5, 5.01, 5.5 轉(zhuǎn)者注:http://support.microsoft.com/default.aspxscid=kb;en-us;Q257717 概要 微軟知識(shí)庫文章 Q17
        推薦度:
        標(biāo)簽: 如何 獲得 接口
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 一区二区三区免费看| 色综合久久精品亚洲国产| 最近免费中文字幕中文高清| 久久久无码精品亚洲日韩软件| 全黄A免费一级毛片| 亚洲婷婷国产精品电影人久久| 无码日韩人妻AV一区免费l | 99久久99久久精品免费看蜜桃| 亚洲高清不卡视频| 免费黄色福利视频| 亚洲精品国产日韩| 国产成人在线观看免费网站| 无套内射无矿码免费看黄| 国产亚洲精品线观看动态图| 男人j进入女人j内部免费网站| 亚洲小视频在线观看| 免费下载成人电影| 亚洲AV无码男人的天堂| 最新精品亚洲成a人在线观看| 永久免费A∨片在线观看| 亚洲色图综合网站| 在线观看免费成人| 美女网站在线观看视频免费的| 亚洲第一中文字幕| 久久不见久久见中文字幕免费| 特级毛片免费播放| 久久精品国产精品亚洲毛片| 最近2019中文字幕mv免费看| 日本一区二区三区在线视频观看免费 | 免费人成网站7777视频| 99久久婷婷免费国产综合精品| 亚洲精品乱码久久久久久下载 | 亚洲免费精彩视频在线观看| 成人男女网18免费视频| 在线观看亚洲专区| 亚洲成a人片在线观看中文动漫 | 国产成人高清精品免费观看| 亚洲欧洲日本国产| 全部免费a级毛片| 久久国产免费观看精品3| 亚洲AV无码国产精品永久一区|