diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 691a90aeb0..9de2345401 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -231,9 +231,9 @@ wxString wxWebViewIE::GetPageSource() const hr = bodyTag->get_parentElement(&htmlTag); if(SUCCEEDED(hr)) { - BSTR bstr; - if ( htmlTag->get_outerHTML(&bstr) == S_OK ) - source = wxString(bstr); + wxBSTR wxbstr; + if ( htmlTag->get_outerHTML(wxbstr.GetAddress()) == S_OK ) + source = wxbstr.GetwxString(); } } return source; @@ -576,9 +576,9 @@ wxString wxWebViewIE::GetCurrentTitle() const wxString s; if(document) { - BSTR title; - if ( document->get_nameProp(&title) == S_OK ) - s = title; + wxBSTR title; + if ( document->get_nameProp(title.GetAddress()) == S_OK ) + s = title.GetwxString(); } return s; @@ -705,10 +705,10 @@ bool wxWebViewIE::IsEditable() const if(document) { - BSTR mode; - if ( document->get_designMode(&mode) == S_OK ) + wxBSTR mode; + if ( document->get_designMode(mode.GetAddress()) == S_OK ) { - if ( wxString(mode) == "On" ) + if ( mode.GetwxString() == "On" ) return true; } } @@ -731,9 +731,9 @@ bool wxWebViewIE::HasSelection() const HRESULT hr = document->get_selection(&selection); if(SUCCEEDED(hr)) { - BSTR type; - if ( selection->get_type(&type) == S_OK ) - sel = wxString(type); + wxBSTR type; + if ( selection->get_type(type.GetAddress()) == S_OK ) + sel = type.GetwxString(); } return sel != "None"; } @@ -767,9 +767,9 @@ wxString wxWebViewIE::GetSelectedText() const hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range); if(SUCCEEDED(hr)) { - BSTR text; - if ( range->get_text(&text) == S_OK ) - selected = wxString(text); + wxBSTR text; + if ( range->get_text(text.GetAddress()) == S_OK ) + selected = text.GetwxString(); } } } @@ -800,9 +800,9 @@ wxString wxWebViewIE::GetSelectedSource() const hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range); if(SUCCEEDED(hr)) { - BSTR text; - if ( range->get_htmlText(&text) == S_OK ) - selected = wxString(text); + wxBSTR text; + if ( range->get_htmlText(text.GetAddress()) == S_OK ) + selected = text.GetwxString(); } } } @@ -841,9 +841,9 @@ wxString wxWebViewIE::GetPageText() const HRESULT hr = document->get_body(&body); if(SUCCEEDED(hr)) { - BSTR out; - if ( body->get_innerText(&out) == S_OK ) - text = wxString(out); + wxBSTR out; + if ( body->get_innerText(out.GetAddress()) == S_OK ) + text = out.GetwxString(); } return text; } @@ -950,7 +950,7 @@ wxCOMPtr wxWebViewIE::GetDocument() const bool wxWebViewIE::IsElementVisible(wxCOMPtr elm) { wxCOMPtr elm1 = elm; - BSTR tmp_bstr; + wxBSTR tmp_bstr; bool is_visible = true; //This method is not perfect but it does discover most of the hidden elements. //so if a better solution is found, then please do improve. @@ -963,13 +963,13 @@ bool wxWebViewIE::IsElementVisible(wxCOMPtr elm) if(SUCCEEDED(elm2->get_currentStyle(&style))) { //Check if the object has the style display:none. - if((style->get_display(&tmp_bstr) != S_OK) || + if((style->get_display(tmp_bstr.GetAddress()) != S_OK) || (tmp_bstr != NULL && (wxCRT_StricmpW(tmp_bstr, L"none") == 0))) { is_visible = false; } //Check if the object has the style visibility:hidden. - if((is_visible && (style->get_visibility(&tmp_bstr) != S_OK)) || + if((is_visible && (style->get_visibility(tmp_bstr.GetAddress()) != S_OK)) || (tmp_bstr != NULL && wxCRT_StricmpW(tmp_bstr, L"hidden") == 0)) { is_visible = false; @@ -1007,8 +1007,8 @@ void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_fla if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupContainer, (void **)&pIMC))) { wxCOMPtr ptrBegin, ptrEnd; - BSTR attr_bstr = SysAllocString(L"style=\"background-color:#ffff00\""); - BSTR text_bstr = SysAllocString(text.wc_str()); + wxBSTR attr_bstr(L"style=\"background-color:#ffff00\""); + wxBSTR text_bstr(text.wc_str()); pIMS->CreateMarkupPointer(&ptrBegin); pIMS->CreateMarkupPointer(&ptrEnd); @@ -1064,9 +1064,6 @@ void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_fla } ptrBegin->MoveToPointer(ptrEnd); } - //Clean up. - SysFreeString(text_bstr); - SysFreeString(attr_bstr); } } }