Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why do IWebBrowser2::Navigate2 return E_FAIL?

Why do IWebBrowser2::Navigate2 return E_FAIL?

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasecomhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johann Gerell
    wrote on last edited by
    #1

    Couldn't get any input from the "Mobile Development" board, so now I turn to the COM giants here :rolleyes: The docs on this are sparse, to say the least... My problem: I'm trying to embed a WebBrowser object in a Windows Mobile application. I can create it and query its size and window handle, but IWebBrowser2::Navigate2 fails with E_FAIL. Can anyone give me any hints to why it fails? Code (yes, C++): My host control is declared like this:

    class HtmlControl : public Window // Window wraps an HWND.
    {
    public:
    HtmlControl(HWND window)
    : Window(window)
    , iOleObject_(NULL)
    {
    iOleSite_.host = this;
    iOleFrame_.host = this;
    CreateWebControl();
    }

    Site iOleSite\_;
    Frame iOleFrame\_;
    IOleObject\* iOleObject\_;              // The WeBrowser object.
    

    private:
    void CreateWebControl();
    };

    Where Site and Frame are declared like this:

    struct Site : public IOleClientSite,
    public IOleInPlaceSite
    {
    HtmlControl* host;

    // IUnknown
    STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
    STDMETHODIMP\_(ULONG) AddRef();
    STDMETHODIMP\_(ULONG) Release();
    
    // IOleClientSite
    STDMETHODIMP SaveObject();
    STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
                            IMoniker\*\* ppmk);
    STDMETHODIMP GetContainer(LPOLECONTAINER FAR\* ppContainer);
    STDMETHODIMP ShowObject();
    STDMETHODIMP OnShowWindow(BOOL fShow);
    STDMETHODIMP RequestNewObjectLayout();
    
    // IOleWindow
    STDMETHODIMP GetWindow(HWND FAR\* lphwnd);
    STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
    
    // IOleInPlaceSite methods
    STDMETHODIMP CanInPlaceActivate();
    STDMETHODIMP OnInPlaceActivate();
    STDMETHODIMP OnUIActivate();
    STDMETHODIMP GetWindowContext(LPOLEINPLACEFRAME FAR\* lplpFrame,
                                  LPOLEINPLACEUIWINDOW FAR\* lplpDoc,
                                  LPRECT lprcPosRect,
                                  LPRECT lprcClipRect,
                                  LPOLEINPLACEFRAMEINFO lpFrameInfo);
    STDMETHODIMP Scroll(SIZE scrollExtent);
    STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
    STDMETHODIMP OnInPlaceDeactivate();
    STDMETHODIMP DiscardUndoState();
    STDMETHODIMP DeactivateAndUndo();
    STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
    

    };

    struct Frame : public IOleInPlaceFrame
    {
    HtmlControl* host;

    // IUnknown
    STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
    STDMETHODIMP\_(ULONG) AddRef();
    STDMETHODIMP\_(ULONG) Release()
    
    J 2 Replies Last reply
    0
    • J Johann Gerell

      Couldn't get any input from the "Mobile Development" board, so now I turn to the COM giants here :rolleyes: The docs on this are sparse, to say the least... My problem: I'm trying to embed a WebBrowser object in a Windows Mobile application. I can create it and query its size and window handle, but IWebBrowser2::Navigate2 fails with E_FAIL. Can anyone give me any hints to why it fails? Code (yes, C++): My host control is declared like this:

      class HtmlControl : public Window // Window wraps an HWND.
      {
      public:
      HtmlControl(HWND window)
      : Window(window)
      , iOleObject_(NULL)
      {
      iOleSite_.host = this;
      iOleFrame_.host = this;
      CreateWebControl();
      }

      Site iOleSite\_;
      Frame iOleFrame\_;
      IOleObject\* iOleObject\_;              // The WeBrowser object.
      

      private:
      void CreateWebControl();
      };

      Where Site and Frame are declared like this:

      struct Site : public IOleClientSite,
      public IOleInPlaceSite
      {
      HtmlControl* host;

      // IUnknown
      STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
      STDMETHODIMP\_(ULONG) AddRef();
      STDMETHODIMP\_(ULONG) Release();
      
      // IOleClientSite
      STDMETHODIMP SaveObject();
      STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
                              IMoniker\*\* ppmk);
      STDMETHODIMP GetContainer(LPOLECONTAINER FAR\* ppContainer);
      STDMETHODIMP ShowObject();
      STDMETHODIMP OnShowWindow(BOOL fShow);
      STDMETHODIMP RequestNewObjectLayout();
      
      // IOleWindow
      STDMETHODIMP GetWindow(HWND FAR\* lphwnd);
      STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
      
      // IOleInPlaceSite methods
      STDMETHODIMP CanInPlaceActivate();
      STDMETHODIMP OnInPlaceActivate();
      STDMETHODIMP OnUIActivate();
      STDMETHODIMP GetWindowContext(LPOLEINPLACEFRAME FAR\* lplpFrame,
                                    LPOLEINPLACEUIWINDOW FAR\* lplpDoc,
                                    LPRECT lprcPosRect,
                                    LPRECT lprcClipRect,
                                    LPOLEINPLACEFRAMEINFO lpFrameInfo);
      STDMETHODIMP Scroll(SIZE scrollExtent);
      STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
      STDMETHODIMP OnInPlaceDeactivate();
      STDMETHODIMP DiscardUndoState();
      STDMETHODIMP DeactivateAndUndo();
      STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
      

      };

      struct Frame : public IOleInPlaceFrame
      {
      HtmlControl* host;

      // IUnknown
      STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
      STDMETHODIMP\_(ULONG) AddRef();
      STDMETHODIMP\_(ULONG) Release()
      
      J Offline
      J Offline
      Jim Crafton
      wrote on last edited by
      #2

      There's a article here on how to host the web browser via C code and the author does an *EXCELLENT* job of walking you through exactly what has to happen - try and look for that, maybe it will off you hints as to what's missing.

      ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

      1 Reply Last reply
      0
      • J Johann Gerell

        Couldn't get any input from the "Mobile Development" board, so now I turn to the COM giants here :rolleyes: The docs on this are sparse, to say the least... My problem: I'm trying to embed a WebBrowser object in a Windows Mobile application. I can create it and query its size and window handle, but IWebBrowser2::Navigate2 fails with E_FAIL. Can anyone give me any hints to why it fails? Code (yes, C++): My host control is declared like this:

        class HtmlControl : public Window // Window wraps an HWND.
        {
        public:
        HtmlControl(HWND window)
        : Window(window)
        , iOleObject_(NULL)
        {
        iOleSite_.host = this;
        iOleFrame_.host = this;
        CreateWebControl();
        }

        Site iOleSite\_;
        Frame iOleFrame\_;
        IOleObject\* iOleObject\_;              // The WeBrowser object.
        

        private:
        void CreateWebControl();
        };

        Where Site and Frame are declared like this:

        struct Site : public IOleClientSite,
        public IOleInPlaceSite
        {
        HtmlControl* host;

        // IUnknown
        STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
        STDMETHODIMP\_(ULONG) AddRef();
        STDMETHODIMP\_(ULONG) Release();
        
        // IOleClientSite
        STDMETHODIMP SaveObject();
        STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
                                IMoniker\*\* ppmk);
        STDMETHODIMP GetContainer(LPOLECONTAINER FAR\* ppContainer);
        STDMETHODIMP ShowObject();
        STDMETHODIMP OnShowWindow(BOOL fShow);
        STDMETHODIMP RequestNewObjectLayout();
        
        // IOleWindow
        STDMETHODIMP GetWindow(HWND FAR\* lphwnd);
        STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
        
        // IOleInPlaceSite methods
        STDMETHODIMP CanInPlaceActivate();
        STDMETHODIMP OnInPlaceActivate();
        STDMETHODIMP OnUIActivate();
        STDMETHODIMP GetWindowContext(LPOLEINPLACEFRAME FAR\* lplpFrame,
                                      LPOLEINPLACEUIWINDOW FAR\* lplpDoc,
                                      LPRECT lprcPosRect,
                                      LPRECT lprcClipRect,
                                      LPOLEINPLACEFRAMEINFO lpFrameInfo);
        STDMETHODIMP Scroll(SIZE scrollExtent);
        STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
        STDMETHODIMP OnInPlaceDeactivate();
        STDMETHODIMP DiscardUndoState();
        STDMETHODIMP DeactivateAndUndo();
        STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
        

        };

        struct Frame : public IOleInPlaceFrame
        {
        HtmlControl* host;

        // IUnknown
        STDMETHODIMP QueryInterface(REFIID riid, void\*\* ppvObject);
        STDMETHODIMP\_(ULONG) AddRef();
        STDMETHODIMP\_(ULONG) Release()
        
        J Offline
        J Offline
        Jim Crafton
        wrote on last edited by
        #3

        PS if you can't find the article I wrote code for C++ on the desktop (don't know how applicable it is to embedded) that does wrap the web browser: Win32WebBrowserHost.h[^] Maybe that will help a bit?

        ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups