X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/66ac04006071ae2043c483ae93f8d4fa6888f33f..4e15d1caa03346c126015019c1fdf093033ef40b:/src/msw/webview_ie.cpp diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index de67e1ee32..0eb1be1c7e 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -38,6 +38,9 @@ namespace { DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb); DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb); DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a); +DEFINE_GUID(wxIID_IHTMLElement2,0x3050f434,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b); +DEFINE_GUID(wxIID_IMarkupServices,0x3050f4a0,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b); +DEFINE_GUID(wxIID_IMarkupContainer,0x3050f5f9,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b); enum //Internal find flags { @@ -101,9 +104,27 @@ bool wxWebViewIE::Create(wxWindow* parent, wxWebViewIE::~wxWebViewIE() { - for(unsigned int i = 0; i < m_factories.size(); i++) + wxDynamicLibrary urlMon(wxT("urlmon.dll")); + if(urlMon.HasSymbol(wxT("CoInternetGetSession"))) { - m_factories[i]->Release(); + typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD, + wxIInternetSession**, + DWORD); + wxDYNLIB_FUNCTION(CoInternetGetSession_t, CoInternetGetSession, urlMon); + + wxIInternetSession* session; + HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0); + if(FAILED(res)) + { + wxFAIL_MSG("Could not retrive internet session"); + } + + for(unsigned int i = 0; i < m_factories.size(); i++) + { + session->UnregisterNameSpace(m_factories[i], + (m_factories[i]->GetName()).wc_str()); + m_factories[i]->Release(); + } } FindClear(); } @@ -913,16 +934,16 @@ wxCOMPtr wxWebViewIE::GetDocument() const bool wxWebViewIE::IsElementVisible(IHTMLElement* elm) { - IHTMLCurrentStyle* style; + wxIHTMLCurrentStyle* style; IHTMLElement *elm1 = elm; - IHTMLElement2 *elm2; + wxIHTMLElement2 *elm2; BSTR 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. while(elm1) { - if(SUCCEEDED(elm1->QueryInterface(IID_IHTMLElement2, (void**) &elm2))) + if(SUCCEEDED(elm1->QueryInterface(wxIID_IHTMLElement2, (void**) &elm2))) { if(SUCCEEDED(elm2->get_currentStyle(&style))) { @@ -961,16 +982,16 @@ bool wxWebViewIE::IsElementVisible(IHTMLElement* elm) void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_flag) { - IMarkupServices *pIMS; - IMarkupContainer *pIMC; - IMarkupPointer *ptrBegin, *ptrEnd; + wxIMarkupServices *pIMS; + wxIMarkupContainer *pIMC; + wxIMarkupPointer *ptrBegin, *ptrEnd; IHTMLElement* elm; long find_flag = 0; IHTMLDocument2 *document = GetDocument(); //This function does the acutal work. - if(SUCCEEDED(document->QueryInterface(IID_IMarkupServices, (void **)&pIMS))) + if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupServices, (void **)&pIMS))) { - if(SUCCEEDED(document->QueryInterface(IID_IMarkupContainer, (void **)&pIMC))) + if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupContainer, (void **)&pIMC))) { BSTR attr_bstr = SysAllocString(L"style=\"background-color:#ffff00\""); BSTR text_bstr = SysAllocString(text.wc_str()); @@ -1017,7 +1038,7 @@ void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_fla } if(internal_flag & wxWEB_VIEW_FIND_ADD_POINTERS) { - IMarkupPointer *cptrBegin, *cptrEnd; + wxIMarkupPointer *cptrBegin, *cptrEnd; pIMS->CreateMarkupPointer(&cptrBegin); pIMS->CreateMarkupPointer(&cptrEnd); cptrBegin->MoveToPointer(ptrBegin); @@ -1085,8 +1106,8 @@ long wxWebViewIE::FindNext(int direction) //some variables to use later on. IHTMLElement *body_element; IHTMLBodyElement *body; - IHTMLTxtRange *range = NULL; - IMarkupServices *pIMS; + wxIHTMLTxtRange *range = NULL; + wxIMarkupServices *pIMS; IHTMLDocument2 *document = GetDocument(); long ret = -1; //Now try to create a range from the body. @@ -1094,12 +1115,12 @@ long wxWebViewIE::FindNext(int direction) { if(SUCCEEDED(body_element->QueryInterface(IID_IHTMLBodyElement,(void**)&body))) { - if(SUCCEEDED(body->createTextRange(&range))) + if(SUCCEEDED(body->createTextRange((IHTMLTxtRange**)(&range)))) { //So far so good, now we try to position our find pointers. - if(SUCCEEDED(document->QueryInterface(IID_IMarkupServices,(void **)&pIMS))) + if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupServices,(void **)&pIMS))) { - IMarkupPointer *begin = m_findPointers[m_findPosition].begin, *end = m_findPointers[m_findPosition].end; + wxIMarkupPointer *begin = m_findPointers[m_findPosition].begin, *end = m_findPointers[m_findPosition].end; if(pIMS->MoveRangeToPointers(begin,end,range) == S_OK && range->select() == S_OK) { ret = m_findPosition;