void CICWXPlayerCtrl::SetHolderID(CICWXPlayerWindowHolder::enumHolderIndex iHolderIndex,LPCTSTR lpszElementID)
{
IOleClientSite* pClientSite=GetClientSite();
do{
if(pClientSite==NULL)break;
CComQIPtrpISP(pClientSite);
if(pISP==NULL)break;
CComPtrpIWebBrowser2;
pISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2,
(void **)&pIWebBrowser2);
if(pIWebBrowser2==NULL)break;
CComPtrspDocument;
pIWebBrowser2->get_Document(&spDocument);
CComQIPtrpIHTMLDocument2(spDocument);
if(pIHTMLDocument2==NULL)break;
CComPtrpHTMLElementCollection;
pIHTMLDocument2->get_all(&pHTMLElementCollection);
if(pHTMLElementCollection==NULL)break;
COleVariant varName(lpszElementID,VT_BSTR);
COleVariant varindex;
CComPtrspElement;
pHTMLElementCollection->item(varName,varindex,&spElement);
if(spElement==NULL)break;
//is it an Iframe?
CComQIPtrpFrame(spElement);
if(pFrame){
switch(iHolderIndex){
case CICWXPlayerWindowHolder::WebHolder:
case CICWXPlayerWindowHolder::TextHolder:
m_holders[iHolderIndex].SetTarget(spElement);
break;
}
}
CComQIPtrpObjectElement(spElement);
if(pObjectElement==NULL)break;
CComPtrspObject;
pObjectElement->get_object(&spObject);
m_holders[iHolderIndex].SetTarget(spObject);
}
while(FALSE);
}
Jiang,Sheng ,a Microsoft Most Valuable Professional of Visual C++, became a Visual C++ programmer at 1999. He actives on several online Visual C++ forums ,blogs and newsgroups
12/07/2003
ActiveX控件访问所在网页的DHTML文档对象模型(MFC)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment