Search Results

Search found 29 results on 2 pages for 'iwebbrowser2'.

Page 2/2 | < Previous Page | 1 2 

  • How to determine direction of navigation from IE WebBrowser (IHtmlWindow2 or Javascript)

    - by Geoff Cox
    I'm uisng the WPF Web Browser control and when it fires the Navigating event, the event args always contain NavigationMode.New. It should be set to NavigationMode.Back if the user chooses to 'Go Back' from the web control. So its off to the COM ActiveX control underneath to determine the direction of navigation. I've been looking at IHtmlWindow2 and IHtmlDocument2 and IOmHistory, but don't see anything that happens on navigation to tell me if the navigation is caused by going back, forward, a new address, or a refresh. Since IHtmlWindow and Javascript have the same DOM, maybe someone knows how from Javascript. I've also been looking at the IWebBrowser2 interface, but can't find anything there either. Is there an event or property I need to inspect?

    Read the article

  • Comparing objects with IDispatch to get main frame only (BHO)

    - by shaimagz
    I don't know if anyone familiar with BHO (Browser Helper Object), but an expert in c++ can help me too. In my BHO I want to run the OnDocumentComplete() function only on the main frame - the first container and not all the Iframes inside the current page. (an alternative is to put some code only when this is the main frame). I can't find how to track when is it the main frame that being populated. After searching in google I found out that each frame has "IDispatch* pDisp", and I have to compare it with a pointer to the first one. This is the main function: STDMETHODIMP Browsarity::SetSite(IUnknown* pUnkSite) { if (pUnkSite != NULL) { // Cache the pointer to IWebBrowser2. HRESULT hr = pUnkSite->QueryInterface(IID_IWebBrowser2, (void **)&m_spWebBrowser); if (SUCCEEDED(hr)) { // Register to sink events from DWebBrowserEvents2. hr = DispEventAdvise(m_spWebBrowser); if (SUCCEEDED(hr)) { m_fAdvised = TRUE; } } } else { // Unregister event sink. if (m_fAdvised) { DispEventUnadvise(m_spWebBrowser); m_fAdvised = FALSE; } // Release cached pointers and other resources here. m_spWebBrowser.Release(); } // Call base class implementation. return IObjectWithSiteImpl<Browsarity>::SetSite(pUnkSite); } This is where I want to be aware whether its the main window(frame) or not: void STDMETHODCALLTYPE Browsarity::OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL) { // as you can see, this function get the IDispatch *pDisp which is unique to every frame. //some code } I asked this question on Microsoft forum and I got an answer without explaining how to actually implement that: http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/7c433bfa-30d7-42db-980a-70e62640184c

    Read the article

  • How to access webbrowser object on this code? C++

    - by extintor
    I found this example http://www.mvps.org/user32/webhost.cab that host an Internet Explorer WebBrowser object, and it uses this code to access the object void webhostwnd::CreateEmbeddedWebControl(void) { OleCreate(CLSID_WebBrowser,IID_IOleObject,OLERENDER_DRAW,0,&site,&storage,(void**)&mpWebObject); mpWebObject->SetHostNames(L"Web Host",L"Web View"); // I have no idea why this is necessary. remark it out and everything works perfectly. OleSetContainedObject(mpWebObject,TRUE); RECT rect; GetClientRect(hwnd,&rect); mpWebObject->DoVerb(OLEIVERB_SHOW,NULL,&site,-1,hwnd,&rect); IWebBrowser2* iBrowser; mpWebObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser); VARIANT vURL; vURL.vt = VT_BSTR; vURL.bstrVal = SysAllocString(L"http://google.com"); VARIANT ve1, ve2, ve3, ve4; ve1.vt = VT_EMPTY; ve2.vt = VT_EMPTY; ve3.vt = VT_EMPTY; ve4.vt = VT_EMPTY; iBrowser->put_Left(0); iBrowser->put_Top(0); iBrowser->put_Width(rect.right); iBrowser->put_Height(rect.bottom); iBrowser->Navigate2(&vURL, &ve1, &ve2, &ve3, &ve4); VariantClear(&vURL); iBrowser->Release(); } I don't have much experience with cpp, I want to know how to access that same ie object (to use Navigate2 for example) from a button or something like that. How could I achieve this?

    Read the article

  • WebBrowser Control in ATL window. How to free up memory on window unload? I'm stuck.

    - by Martin
    Hello there. I have a Win32 C++ Application. There is the _tWinMain(...) Method with GetMessage(...) in a while loop at the end. Before GetMessage(...) I create the main window with HWND m_MainHwnd = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, CAxWindow::GetWndClassName(), _TEXT("http://www.-website-.com"), WS_POPUP, 0, 0, 1024, 768, NULL, NULL, m_Instance, NULL); ShowWindow(m_MainHwnd) If I do not create the main window, my application needs about 150K in memory. But with creating the main window with the WebBrowser Control inside, the memory usage increases to 8500K. But, I want to dynamically unload the main window. My _tWinMain(...) keeps running! Im unloading with DestroyWindow(m_MainHwnd) But the WebBrowser control won't unload and free up it's memory used! Application memory used is still 8500K! I can also get the WebBrowser Instance or with some additional code the WebBrowser HWND IWebBrowser2* m_pWebBrowser2; CAxWindow wnd = (CAxWindow)m_MainHwnd; HRESULT hRet = wnd.QueryControl(IID_IWebBrowser2, (void**)&m_pWebBrowser2); So I tried to free up the memory used by main window and WebBrowser control with (let's say it's experimental): if(m_pWebBrowser2) m_pWebBrowser2->Release(); DestroyWindow(m_hwndWebBrowser); //<-- just analogous OleUninitialize(); No success at all. I also created a wrapper class which creates the main window. I created a pointer and freed it up with delete: Wrapper* wrapper = new Wrapper(); //wrapper creates main window inside and shows it //...do some stuff delete(wrapper); No success. Still 8500K. So please, how can I get rid of the main window and it's WebBrowser control and free up the memory, returning to about 150K. Later I will recreate the window. It's a dynamically load and unload of the main window, depending on other commands. Thanks! Regards Martin

    Read the article

< Previous Page | 1 2