Here's a way to control ie for refreshing:
First step, create
SHDocVw::IShellWindowsPtr m_spSHWinds;
if (m_spSHWinds == NULL){
if (m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows)) != S_OK){
MessageBox("Failed");
CoUninitialize();
EndDialog(1);
}
}
Step two, get all the currently open IE windows
if (m_spSHWinds){
int n = m_spSHWinds->GetCount();
for (int i = 0; i < n; i++){
_variant_t v = (long)i;
IDispatchPtr spDisp = m_spSHWinds->Item(v);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp); //生成一个IE窗口的智能指针
if (spBrowser){
_bstr_t bsName = spBrowser->GetLocationName(); //窗口名称
int nPos = m_ctrlIE.InsertItem(0, bsName);
spBrowser->AddRef();
void * pData = spBrowser;
m_ctrlIE.SetItemData(nPos, (DWORD)(pData));
}
}
}
Third step, refresh IE window
Pbrowser->refresh (); Pbrowser Point to Shdocvw::iwebbrowser2ptr
Of course, we have access to the IE window after the IWebBrowser2, we can control the IE, such as reading the content of the settings element, as well as some other more control, reference Iwebbrowser2,ihtmldocument2, etc.!!!!
Compilation Environment Win2000 Professional + VC6.0 (en) + sp5.0 + Platform SDK 2001.8
Test passes under Win2000 Professional, such as compilation however, please download the latest platform SDK
This article supporting source code