In C++, a connection can be accomplished in roughly the same way. Visual C++ Native Com Support is used here for the sake of brevity.
Add references to Shdocvw.dll and Mshtml.dll to the project:
#import <mshtml.dll> // Internet Explorer 4.0x
#import <mshtml.tlb> // Internet Explorer 5
#import <shdocvw.dll>
Declare an instance of an IShellWindows pointer in your view class:
SHDocVw::IShellWindowsPtr m_spSHWinds;
Create an instance of a ShellWindows object in your view's constructor:
m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
Use the ShellWindows object in your view's OnInitialUpdate function:
void CConnectIEView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ASSERT(m_spSHWinds != NULL);
CString strCount;
long nCount = m_spSHWinds->GetCount();