在自己的应用程序中连接IE的实例,源码如下:
#import "mshtml.tlb": // Internet Explorer 5 #import "shdocvw.dl"
void CIEEnumWindowsDlg::ConnectToShell() { CoInitialize(NULL); if(m_spSHWinds == 0) { //// Get reference to ShellWindows interface// if(m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows)) == S_OK) { // Event Sink // LPCONNECTIONPOINTCONTAINER pConnPtCont; if ((m_spSHWinds != NULL) && SUCCEEDED(m_spSHWinds->QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pConnPtCont))) { ASSERT(pConnPtCont != NULL); LPCONNECTIONPOINT pConnPt = NULL; DWORD dwCookie = 0; if (SUCCEEDED(pConnPtCont->FindConnectionPoint( __uuidof(SHDocVw::DShellWindowsEvents), &pConnPt))) { ASSERT(pConnPt != NULL); pConnPt->Advise( this->GetIDispatch(FALSE), &dwCookie); pConnPt->Release(); } pConnPtCont->Release(); } } else { AfxMessageBox("Shell Windows interface is not avilable"); } } }
>>> DOWN !!! >>>下载源代码及演示程序