Why do IWebBrowser2::Navigate2 return E_FAIL?
-
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, butIWebBrowser2::Navigate2
fails withE_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
andFrame
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()
-
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, butIWebBrowser2::Navigate2
fails withE_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
andFrame
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()
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
-
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, butIWebBrowser2::Navigate2
fails withE_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
andFrame
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()
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