void wxWebViewIE::LoadUrl(const wxString& url)
{
- wxVariant out = m_ie.CallMethod("Navigate", (BSTR) url.wc_str(),
- NULL, NULL, NULL, NULL);
-
- // FIXME: why is out value null??
- //(HRESULT)(out.GetLong()) == S_OK;
+ m_ie.CallMethod("Navigate", (BSTR) url.wc_str(), NULL, NULL, NULL, NULL);
}
void wxWebViewIE::SetPage(const wxString& html, const wxString&)
IHTMLDocument2* document = GetDocument();
IHTMLElement *bodyTag = NULL;
IHTMLElement *htmlTag = NULL;
- document->get_body(&bodyTag);
- wxASSERT(bodyTag != NULL);
+ BSTR bstr;
+ HRESULT hr = document->get_body(&bodyTag);
+ if(SUCCEEDED(hr))
+ {
+ hr = bodyTag->get_parentElement(&htmlTag);
+ if(SUCCEEDED(hr))
+ {
+ htmlTag->get_outerHTML(&bstr);
+ htmlTag->Release();
+ }
+ bodyTag->Release();
+ }
document->Release();
- bodyTag->get_parentElement(&htmlTag);
- wxASSERT(htmlTag != NULL);
-
- BSTR bstr;
- htmlTag->get_outerHTML(&bstr);
-
- bodyTag->Release();
- htmlTag->Release();
-
- //wxMessageBox(wxString(bstr));
-
- // TODO: check encoding
return wxString(bstr);
}
wxASSERT (result == S_OK);
int zoom = V_I4(&zoomVariant);
- // wxMessageBox(wxString::Format("Zoom : %i", zoom));
VariantClear (&zoomVariant);
return zoom;
void wxWebViewIE::Stop()
{
- wxVariant out = m_ie.CallMethod("Stop");
-
- // FIXME: why is out value null??
- //return (HRESULT)(out.GetLong()) == S_OK;
+ m_ie.CallMethod("Stop");
}
void wxWebViewIE::ClearHistory()
wxString wxWebViewIE::GetCurrentTitle()
{
IHTMLDocument2* document = GetDocument();
-
BSTR title;
+
document->get_nameProp(&title);
+ document->Release();
return wxString(title);
}
document->put_designMode(SysAllocString(L"On"));
else
document->put_designMode(SysAllocString(L"Off"));
+
+ document->Release();
}
bool wxWebViewIE::IsEditable()
return true;
else
return false;
+
+ document->Release();
}
void wxWebViewIE::SelectAll()
{
IHTMLDocument2* document = GetDocument();
IHTMLSelectionObject* selection;
- document->get_selection(&selection);
BSTR type;
- selection->get_type(&type);
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ selection->get_type(&type);
+ selection->Release();
+ }
+ document->Release();
return wxString(type) != "None";
}
bool wxWebViewIE::CanExecCommand(wxString command)
{
IHTMLDocument2* document = GetDocument();
-
VARIANT_BOOL enabled;
+
document->queryCommandEnabled(SysAllocString(command.wc_str()), &enabled);
+ document->Release();
return (enabled == VARIANT_TRUE);
}
{
IHTMLDocument2* document = GetDocument();
document->execCommand(SysAllocString(command.wc_str()), VARIANT_FALSE, VARIANT(), NULL);
+ document->Release();
}
IHTMLDocument2* wxWebViewIE::GetDocument()