void IEView::clear() { #ifdef GECKO pWebBrowser->Navigate(L"www.onet.pl", NULL, NULL, NULL, NULL); return; #endif IHTMLDocument2 *document = getDocument(); if (document == NULL) { pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL); HRESULT hr = S_OK; IHTMLDocument2 *document = NULL; while ((document == NULL) && (hr == S_OK)) { Sleep(0); IDispatch *dispatch = NULL; if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && (dispatch != NULL)) { hr = dispatch->QueryInterface(IID_IHTMLDocument2, (void **)&document); dispatch->Release(); } } if (document != NULL) { document->Release(); } } else { document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = SysAllocString(L"_self"); VariantInit(&open_features); VariantInit(&open_replace); HRESULT hr = document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) { // pWebBrowser->Refresh(); } if (open_window != NULL) { open_window->Release(); } document->Release(); } hDbEventFirst = NULL; if (builder!=NULL) { IEVIEWEVENT event; event.cbSize = sizeof(IEVIEWEVENT); event.hContact = hContact; event.dwFlags = dwLogFlags; event.codepage = iLogCodepage; builder->buildHead(this, &event); } }
void IEView::clear(IEVIEWEVENT *event) { #ifdef GECKO // pWebBrowser->Navigate(L"www.onet.pl", NULL, NULL, NULL, NULL); // return; #endif IHTMLDocument2 *document = getDocument(); if (document == NULL) { pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL); HRESULT hr = S_OK; IHTMLDocument2 *document = NULL; while ((document == NULL) && (hr == S_OK)) { Sleep(0); IDispatch *dispatch = NULL; if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && (dispatch != NULL)) { hr = dispatch->QueryInterface(IID_IHTMLDocument2, (void **)&document); dispatch->Release(); } } if (document != NULL) { document->Release(); } } else { document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = SysAllocString(L"_self"); VariantInit(&open_features); VariantInit(&open_replace); HRESULT hr = document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) { // pWebBrowser->Refresh(); } if (open_window != NULL) { open_window->Release(); } document->Release(); } if (builder!=NULL) { builder->clear(this, event); } clearRequired = false; getFocus = false; }
void SimpleBrowser::Clear() { IHTMLDocument2* document = GetDocument(); if (document != NULL) { HRESULT hr = S_OK; document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; ::VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = ::SysAllocString(L"_self"); ::VariantInit(&open_features); ::VariantInit(&open_replace); hr = document->open(::SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) Refresh(); if (open_window != NULL) open_window->Release(); } }
void CWtlHtmlView::Clear() { if (m_spWebBrowser2 != NULL) { // if document interface available, close/re-open document to clear display IHTMLDocument2 *document = GetDocument(); HRESULT hr = S_OK; if (document != NULL) { // close and re-open document to empty contents document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; ::VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = ::SysAllocString(L"_self"); ::VariantInit(&open_features); ::VariantInit(&open_replace); hr = document->open(::SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) { Refresh(); } if (open_window != NULL) { open_window->Release(); } } // otherwise, navigate to about:blank and wait for document ready else { Navigate(_T("about:blank")); IHTMLDocument2 *document = NULL; HRESULT hr = S_OK; while ((document == NULL) && (hr == S_OK)) { Sleep(0); IDispatch *document_dispatch = NULL; hr = m_spWebBrowser2->get_Document(&document_dispatch); // if dispatch interface available, retrieve document interface if (SUCCEEDED(hr) && (document_dispatch != NULL)) { // retrieve document interface hr = document_dispatch->QueryInterface(IID_IHTMLDocument2,(void **)&document); document_dispatch->Release(); } } if (document != NULL) { document->Release(); } } } }
void IEView::clear(IEVIEWEVENT *event) { #ifdef GECKO pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL); Utils::forkThread((void (__cdecl *)(void *))StartThread, 0, (void *) this); MSG msg; BOOL bRet; while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) { if (bRet == -1) { // handle the error and possibly exit } else { if (msg.message == WM_WAITWHILEBUSY) { break; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } } { IHTMLDocument2 *document = getDocument(); if (document != NULL) { document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = SysAllocString(L"_self"); VariantInit(&open_features); VariantInit(&open_replace); HRESULT hr = document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) { // pWebBrowser->Refresh(); } if (open_window != NULL) { open_window->Release(); } document->Release(); } if (builder!=NULL) { builder->clear(this, event); } clearRequired = false; getFocus = false; } return; #endif IHTMLDocument2 *document = getDocument(); if (document == NULL) { pWebBrowser->Navigate(L"about:blank", NULL, NULL, NULL, NULL); HRESULT hr = S_OK; IHTMLDocument2 *document = NULL; while ((document == NULL) && (hr == S_OK)) { Sleep(0); IDispatch *dispatch = NULL; if (SUCCEEDED(pWebBrowser->get_Document(&dispatch)) && (dispatch != NULL)) { hr = dispatch->QueryInterface(IID_IHTMLDocument2, (void **)&document); dispatch->Release(); } } if (document != NULL) { document->Release(); } } else { document->close(); VARIANT open_name; VARIANT open_features; VARIANT open_replace; IDispatch *open_window = NULL; VariantInit(&open_name); open_name.vt = VT_BSTR; open_name.bstrVal = SysAllocString(L"_self"); VariantInit(&open_features); VariantInit(&open_replace); HRESULT hr = document->open(SysAllocString(L"text/html"), open_name, open_features, open_replace, &open_window); if (hr == S_OK) { // pWebBrowser->Refresh(); } if (open_window != NULL) { open_window->Release(); } document->Release(); } if (builder!=NULL) { builder->clear(this, event); } clearRequired = false; getFocus = false; setBorder(); }