i query class info or guid of clients who are connected to ie
Hi,
I am new to com devolpment.
How can i query class info or guid of clients who are connected (by
connection point) to the ie instance from another com exe.
Here is the code which i was using
but querying IProvideClassInfo fails
SHDocVw::IShellWindowsPtr m_spSHWinds;
m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
long nCount = m_spSHWinds->GetCount();
IDispatchPtr spDisp;
_variant_t va(1, VT_I4);
spDisp = m_spSHWinds->Item(va);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
// Retrieve and store the IWebBrowser2 pointer
CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> m_pWebBrowser2;
m_pWebBrowser2 = spBrowser;
if (m_pWebBrowser2 != NULL)
{
// Retrieve and store the IConnectionPointerContainer
pointer
m_pICPC = m_pWebBrowser2;
if (m_pICPC != NULL)
{
HRESULT hr = S_FALSE;
CComPtr<IConnectionPoint>m_pICP;
DWORD m_dwCookie;
// Receives the connection
point for WebBrowser events
hr =
m_pICPC->FindConnectionPoint(DIID_DWebBrowserEvents2, &m_pICP);
if (FAILED(hr)) return
E_POINTER;
IEnumConnections* m_pEnumConnections
= NULL;
hr =
m_pICP->EnumConnections(&m_pEnumConnections);
if (FAILED(hr)) return E_POINTER;
m_pEnumConnections->AddRef();
CONNECTDATA cd;
unsigned long pcFetched = 0;
while (m_pEnumConnections->Next(1,
&cd, &pcFetched)== S_OK)
{
CComPtr<IProvideClassInfo2>m_pIProvideClassInfo2;
hr = cd.pUnk->QueryInterface(IID_IProvideClassInfo2,
(void**)&m_pIProvideClassInfo2);
//FAILS WHEN CALLING QUERY INTERFACE
cd.pUnk->Release();
}
m_pEnumConnections->Release();
}
}
Thanks in advance,
bejoy