<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
        主站蜘蛛池模板: 国产美女在线精品免费观看| 69成人免费视频无码专区| 免费人成在线观看播放国产| 亚洲AV无码一区二区三区久久精品 | 一级特黄aaa大片免费看| 国产免费久久精品| 美女被艹免费视频| 亚洲国产精品人人做人人爽| 高h视频在线免费观看| 久久久久国产亚洲AV麻豆| 美女巨胸喷奶水视频www免费| 久久精品国产亚洲精品| 国产免费一区二区三区不卡| 久久久久久亚洲精品中文字幕| 免费很黄很色裸乳在线观看| 青娱乐在线视频免费观看| 亚洲片一区二区三区| 国产免费一区二区三区不卡| 亚洲精品国产专区91在线| 成人免费无码视频在线网站| 精品国产亚洲一区二区三区在线观看 | 国产乱辈通伦影片在线播放亚洲 | 亚洲天天做日日做天天欢毛片| 13一14周岁毛片免费| 亚洲精品卡2卡3卡4卡5卡区| 2020因为爱你带字幕免费观看全集 | 亚洲精品国产啊女成拍色拍| 在线A级毛片无码免费真人| 色天使色婷婷在线影院亚洲| 亚洲综合国产一区二区三区| 57pao一国产成永久免费| 亚洲成a∨人片在无码2023| 久久久久亚洲AV无码专区桃色| 99久久99热精品免费观看国产| 精品亚洲成A人无码成A在线观看| 日本19禁啪啪无遮挡免费动图| 日本一区午夜艳熟免费| 亚洲精品一二三区| 国产AV无码专区亚洲AWWW| 三年片在线观看免费大全| yellow视频免费在线观看|