mshtml: Added HTMLWindow's IDispatch methods implementation.

This commit is contained in:
Jacek Caban 2007-07-31 00:53:10 +02:00 committed by Alexandre Julliard
parent 7d1c59edce
commit 4005cf72d6
3 changed files with 88 additions and 11 deletions

View File

@ -98,16 +98,26 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
static HRESULT WINAPI HTMLWindow2_GetTypeInfoCount(IHTMLWindow2 *iface, UINT *pctinfo)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
}
static HRESULT WINAPI HTMLWindow2_GetTypeInfo(IHTMLWindow2 *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
HRESULT hres;
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
hres = get_typeinfo(IHTMLWindow2_tid, ppTInfo);
if(SUCCEEDED(hres))
ITypeInfo_AddRef(*ppTInfo);
return hres;
}
static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid,
@ -115,9 +125,17 @@ static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid
LCID lcid, DISPID *rgDispId)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
return E_NOTIMPL;
ITypeInfo *typeinfo;
HRESULT hres;
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
hres = get_typeinfo(IHTMLWindow2_tid, &typeinfo);
if(SUCCEEDED(hres))
hres = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
return hres;
}
static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMember,
@ -125,9 +143,18 @@ static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMembe
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_NOTIMPL;
ITypeInfo *typeinfo;
HRESULT hres;
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hres = get_typeinfo(IHTMLWindow2_tid, &typeinfo);
if(SUCCEEDED(hres))
hres = ITypeInfo_Invoke(typeinfo, HTMLWINDOW2(This), dispIdMember, wFlags, pDispParams,
pVarResult, pExcepInfo, puArgErr);
return hres;
}
static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, VARIANT *pvarResult)

View File

@ -51,10 +51,52 @@ DWORD mshtml_tls = 0;
static HINSTANCE shdoclc = NULL;
static ITypeLib *typelib;
static ITypeInfo *typeinfos[LAST_tid];
static const REFIID tid_ids[] = {
&IID_IHTMLWindow2
};
HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
{
HRESULT hres;
if(!typelib) {
hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &typelib);
if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres;
}
}
if(!typeinfos[tid]) {
hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], typeinfos+tid);
if(FAILED(hres)) {
ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
return hres;
}
}
*typeinfo = typeinfos[tid];
return S_OK;
}
static void thread_detach(void)
{
thread_data_t *thread_data = get_thread_data(FALSE);
thread_data_t *thread_data;
if(typelib) {
unsigned i;
for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
ITypeLib_Release(typelib);
}
thread_data = get_thread_data(FALSE);
if(!thread_data)
return;

View File

@ -472,6 +472,14 @@ HWND get_thread_hwnd(void);
void push_task(task_t*);
void remove_doc_tasks(const HTMLDocument*);
/* typelibs */
enum tid_t {
IHTMLWindow2_tid,
LAST_tid
};
HRESULT get_typeinfo(enum tid_t, ITypeInfo**);
DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);