Commit eea60a66 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Activate document object.

parent 1b1880b0
...@@ -18,11 +18,83 @@ ...@@ -18,11 +18,83 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "shdocvw.h" #include "shdocvw.h"
#include "hlink.h"
#include "exdispid.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
static ATOM doc_view_atom = 0; static ATOM doc_view_atom = 0;
static void navigate_complete(WebBrowser *This)
{
IDispatch *disp, *docdisp = NULL;
DISPPARAMS dispparams;
VARIANTARG params[2];
VARIANT url;
HRESULT hres;
hres = IOleClientSite_QueryInterface(This->client, &IID_IDispatch, (void**)&disp);
if(FAILED(hres))
return;
hres = IUnknown_QueryInterface(This->document, &IID_IDispatch, (void**)&docdisp);
if(FAILED(hres))
FIXME("Could not get IDispatch interface\n");
dispparams.cArgs = 2;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = params;
V_VT(params) = (VT_BYREF|VT_VARIANT);
V_BYREF(params) = &url;
V_VT(params+1) = VT_DISPATCH;
V_DISPATCH(params+1) = docdisp;
V_VT(&url) = VT_BSTR;
V_BSTR(&url) = This->url;
IDispatch_Invoke(disp, DISPID_NAVIGATECOMPLETE2, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
IDispatch_Invoke(disp, DISPID_DOCUMENTCOMPLETE, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
IDispatch_Release(disp);
if(docdisp)
IDispatch_Release(docdisp);
}
static LRESULT navigate2(WebBrowser *This)
{
IHlinkTarget *hlink;
HRESULT hres;
TRACE("(%p)\n", This);
if(!This->document) {
WARN("document == NULL\n");
return 0;
}
hres = IUnknown_QueryInterface(This->document, &IID_IHlinkTarget, (void**)&hlink);
if(FAILED(hres)) {
FIXME("Could not get IHlinkTarget interface\n");
return 0;
}
hres = IHlinkTarget_Navigate(hlink, 0, NULL);
IHlinkTarget_Release(hlink);
if(FAILED(hres)) {
FIXME("Navigate failed\n");
return 0;
}
navigate_complete(This);
return 0;
}
static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
WebBrowser *This; WebBrowser *This;
...@@ -37,6 +109,11 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l ...@@ -37,6 +109,11 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
This = GetPropW(hwnd, wszTHIS); This = GetPropW(hwnd, wszTHIS);
} }
switch(msg) {
case WB_WM_NAVIGATE2:
return navigate2(This);
}
return DefWindowProcA(hwnd, msg, wParam, lParam); return DefWindowProcA(hwnd, msg, wParam, lParam);
} }
......
...@@ -91,6 +91,8 @@ typedef struct { ...@@ -91,6 +91,8 @@ typedef struct {
IOleContainer *container; IOleContainer *container;
IOleDocumentView *view; IOleDocumentView *view;
LPOLESTR url;
/* window context */ /* window context */
HWND iphwnd; HWND iphwnd;
...@@ -152,6 +154,8 @@ HRESULT WebBrowser_Create(IUnknown*,REFIID,void**); ...@@ -152,6 +154,8 @@ HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
void create_doc_view_hwnd(WebBrowser *This); void create_doc_view_hwnd(WebBrowser *This);
#define WB_WM_NAVIGATE2 (WM_USER+100)
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
/********************************************************************** /**********************************************************************
......
...@@ -128,6 +128,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface) ...@@ -128,6 +128,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
WebBrowser_Events_Destroy(This); WebBrowser_Events_Destroy(This);
WebBrowser_ClientSite_Destroy(This); WebBrowser_ClientSite_Destroy(This);
SysFreeString(This->url);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule(); SHDOCVW_UnlockModule();
} }
...@@ -551,6 +552,8 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA ...@@ -551,6 +552,8 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
return hres; return hres;
} }
This->url = SysAllocString(V_BSTR(URL));
hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj); hres = IUnknown_QueryInterface(This->document, &IID_IOleObject, (void**)&oleobj);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -558,6 +561,8 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA ...@@ -558,6 +561,8 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This)); hres = IOleObject_SetClientSite(oleobj, CLIENTSITE(This));
IOleObject_Release(oleobj); IOleObject_Release(oleobj);
PostMessageW(This->doc_view_hwnd, WB_WM_NAVIGATE2, 0, 0);
return hres; return hres;
} }
...@@ -783,6 +788,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv) ...@@ -783,6 +788,7 @@ HRESULT WebBrowser_Create(IUnknown *pOuter, REFIID riid, void **ppv)
ret->ref = 0; ret->ref = 0;
ret->document = NULL; ret->document = NULL;
ret->url = NULL;
WebBrowser_OleObject_Init(ret); WebBrowser_OleObject_Init(ret);
WebBrowser_ViewObject_Init(ret); WebBrowser_ViewObject_Init(ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment