VARIANT flag;
flag.vt = VT_I4;
flag.iVal = navNoHistory | navNoReadFromCache | navNoWriteToCache;
m_browser.Navigate(m_url, &flag, NULL, NULL, NULL);
m_browser.put_Silent(TRUE);
MSG msg;
DWORD
dwTimeStarted = ::GetTickCount();
for
(
int
i = 0; i != 3; ++i)
{
while
(1000 > ::GetTickCount() - dwTimeStarted)
{
if
(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
BSTR bstr;
HRESULT
hResult = S_OK;
IHTMLElement* pElement1 = NULL;
IHTMLElement* pElement2 = NULL;
IHTMLDocument2* pDoc = (IHTMLDocument2*)m_browser.get_Document();
if
(NULL != pDoc)
{
hResult = pDoc->get_body(&pElement1);
if
(S_OK == hResult && NULL != pElement1)
{
hResult = pElement1->get_parentElement(&pElement2);
if
(S_OK == hResult && NULL != pElement2)
{
hResult = pElement2->get_outerHTML(&bstr);
if
(S_OK == hResult)
{
pDoc->Release();
pDoc = NULL;
pElement1->Release();
pElement1 = NULL;
pElement2->Release();
pElement2 = NULL;
}
}
}
}
else
{
if
(NULL != pDoc)
{
pDoc->Release();
pDoc = NULL;
}
if
(NULL != pElement1)
{
pElement1->Release();
pElement1 = NULL;
}
if
(NULL != pElement2)
{
pElement2->Release();
pElement2 = NULL;
}
return
;
}
str_text = bstr;