msi/tests: Avoid size_t in traces.
[wine/hacks.git] / dlls / mshtml / htmlwindow.c
bloba92870941bf160ee0e2bc043339447a3df9d7db0
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
32 #include "resource.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 static struct list window_list = LIST_INIT(window_list);
38 #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
40 static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
42 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
44 *ppv = NULL;
46 if(IsEqualGUID(&IID_IUnknown, riid)) {
47 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
48 *ppv = HTMLWINDOW2(This);
49 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
50 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
51 *ppv = HTMLWINDOW2(This);
52 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
53 TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv);
54 *ppv = DISPATCHEX(This);
55 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2, riid)) {
56 TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This, ppv);
57 *ppv = HTMLWINDOW2(This);
58 }else if(IsEqualGUID(&IID_IHTMLWindow2, riid)) {
59 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv);
60 *ppv = HTMLWINDOW2(This);
61 }else if(IsEqualGUID(&IID_IHTMLWindow3, riid)) {
62 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This, ppv);
63 *ppv = HTMLWINDOW3(This);
64 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
65 return *ppv ? S_OK : E_NOINTERFACE;
68 if(*ppv) {
69 IUnknown_AddRef((IUnknown*)*ppv);
70 return S_OK;
73 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
74 return E_NOINTERFACE;
77 static ULONG WINAPI HTMLWindow2_AddRef(IHTMLWindow2 *iface)
79 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
80 LONG ref = InterlockedIncrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, ref);
84 return ref;
87 static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
89 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
90 LONG ref = InterlockedDecrement(&This->ref);
92 TRACE("(%p) ref=%d\n", This, ref);
94 if(!ref) {
95 list_remove(&This->entry);
96 heap_free(This);
99 return ref;
102 static HRESULT WINAPI HTMLWindow2_GetTypeInfoCount(IHTMLWindow2 *iface, UINT *pctinfo)
104 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
106 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
109 static HRESULT WINAPI HTMLWindow2_GetTypeInfo(IHTMLWindow2 *iface, UINT iTInfo,
110 LCID lcid, ITypeInfo **ppTInfo)
112 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
114 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
117 static HRESULT WINAPI HTMLWindow2_GetIDsOfNames(IHTMLWindow2 *iface, REFIID riid,
118 LPOLESTR *rgszNames, UINT cNames,
119 LCID lcid, DISPID *rgDispId)
121 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
123 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
126 static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMember,
127 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
128 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
130 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
132 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
133 pVarResult, pExcepInfo, puArgErr);
136 static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, VARIANT *pvarResult)
138 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
139 FIXME("(%p)->(%p %p)\n", This, pvarIndex, pvarResult);
140 return E_NOTIMPL;
143 static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
145 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
146 FIXME("(%p)->(%p)\n", This, p);
147 return E_NOTIMPL;
150 static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
152 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
153 FIXME("(%p)->(%p)\n", This, p);
154 return E_NOTIMPL;
157 static HRESULT WINAPI HTMLWindow2_put_defaultStatus(IHTMLWindow2 *iface, BSTR v)
159 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
160 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
161 return E_NOTIMPL;
164 static HRESULT WINAPI HTMLWindow2_get_defaultStatus(IHTMLWindow2 *iface, BSTR *p)
166 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
167 FIXME("(%p)->(%p)\n", This, p);
168 return E_NOTIMPL;
171 static HRESULT WINAPI HTMLWindow2_put_status(IHTMLWindow2 *iface, BSTR v)
173 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
174 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
175 return E_NOTIMPL;
178 static HRESULT WINAPI HTMLWindow2_get_status(IHTMLWindow2 *iface, BSTR *p)
180 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
181 FIXME("(%p)->(%p)\n", This, p);
182 return E_NOTIMPL;
185 static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expression,
186 LONG msec, VARIANT *language, LONG *timerID)
188 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
189 VARIANT expr_var;
191 TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
193 V_VT(&expr_var) = VT_BSTR;
194 V_BSTR(&expr_var) = expression;
196 return IHTMLWindow3_setTimeout(HTMLWINDOW3(This), &expr_var, msec, language, timerID);
199 static HRESULT WINAPI HTMLWindow2_clearTimeout(IHTMLWindow2 *iface, LONG timerID)
201 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
203 TRACE("(%p)->(%d)\n", This, timerID);
205 return clear_task_timer(This->doc, FALSE, timerID);
208 static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message)
210 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
211 WCHAR wszTitle[100];
213 TRACE("(%p)->(%s)\n", This, debugstr_w(message));
215 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
216 sizeof(wszTitle)/sizeof(WCHAR))) {
217 WARN("Could not load message box title: %d\n", GetLastError());
218 return S_OK;
221 MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING);
222 return S_OK;
225 static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
226 VARIANT_BOOL *confirmed)
228 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
229 WCHAR wszTitle[100];
231 TRACE("(%p)->(%s %p)\n", This, debugstr_w(message), confirmed);
233 if(!confirmed) return E_INVALIDARG;
235 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
236 sizeof(wszTitle)/sizeof(WCHAR))) {
237 WARN("Could not load message box title: %d\n", GetLastError());
238 *confirmed = VARIANT_TRUE;
239 return S_OK;
242 if(MessageBoxW(This->doc->hwnd, message, wszTitle,
243 MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
244 *confirmed = VARIANT_TRUE;
245 else *confirmed = VARIANT_FALSE;
247 return S_OK;
250 typedef struct
252 BSTR message;
253 BSTR dststr;
254 VARIANT *textdata;
255 }prompt_arg;
257 static INT_PTR CALLBACK prompt_dlgproc(HWND hwnd, UINT msg,
258 WPARAM wparam, LPARAM lparam)
260 switch(msg)
262 case WM_INITDIALOG:
264 prompt_arg *arg = (prompt_arg*)lparam;
265 WCHAR wszTitle[100];
267 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE, wszTitle,
268 sizeof(wszTitle)/sizeof(WCHAR))) {
269 WARN("Could not load message box title: %d\n", GetLastError());
270 EndDialog(hwnd, wparam);
271 return FALSE;
274 SetWindowLongPtrW(hwnd, DWLP_USER, lparam);
275 SetWindowTextW(hwnd, wszTitle);
276 SetWindowTextW(GetDlgItem(hwnd, ID_PROMPT_PROMPT), arg->message);
277 SetWindowTextW(GetDlgItem(hwnd, ID_PROMPT_EDIT), arg->dststr);
278 return FALSE;
280 case WM_COMMAND:
281 switch(wparam)
283 case MAKEWPARAM(IDCANCEL, BN_CLICKED):
284 EndDialog(hwnd, wparam);
285 return TRUE;
286 case MAKEWPARAM(IDOK, BN_CLICKED):
288 prompt_arg *arg =
289 (prompt_arg*)GetWindowLongPtrW(hwnd, DWLP_USER);
290 HWND hwndPrompt = GetDlgItem(hwnd, ID_PROMPT_EDIT);
291 INT len = GetWindowTextLengthW(hwndPrompt);
293 if(!arg->textdata)
295 EndDialog(hwnd, wparam);
296 return TRUE;
299 V_VT(arg->textdata) = VT_BSTR;
300 if(!len && !arg->dststr)
301 V_BSTR(arg->textdata) = NULL;
302 else
304 V_BSTR(arg->textdata) = SysAllocStringLen(NULL, len);
305 GetWindowTextW(hwndPrompt, V_BSTR(arg->textdata), len+1);
307 EndDialog(hwnd, wparam);
308 return TRUE;
311 return FALSE;
312 case WM_CLOSE:
313 EndDialog(hwnd, IDCANCEL);
314 return TRUE;
315 default:
316 return FALSE;
320 static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
321 BSTR dststr, VARIANT *textdata)
323 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
324 prompt_arg arg;
326 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(message), debugstr_w(dststr), textdata);
328 if(textdata) V_VT(textdata) = VT_NULL;
330 arg.message = message;
331 arg.dststr = dststr;
332 arg.textdata = textdata;
334 DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG),
335 This->doc->hwnd, prompt_dlgproc, (LPARAM)&arg);
336 return S_OK;
339 static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p)
341 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
342 FIXME("(%p)->(%p)\n", This, p);
343 return E_NOTIMPL;
346 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
348 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
350 TRACE("(%p)->(%p)\n", This, p);
352 if(!This->doc) {
353 FIXME("This->doc is NULL\n");
354 return E_FAIL;
357 return IHTMLDocument2_get_location(HTMLDOC(This->doc), p);
360 static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p)
362 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
363 FIXME("(%p)->(%p)\n", This, p);
364 return E_NOTIMPL;
367 static HRESULT WINAPI HTMLWindow2_close(IHTMLWindow2 *iface)
369 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
370 FIXME("(%p)->()\n", This);
371 return E_NOTIMPL;
374 static HRESULT WINAPI HTMLWindow2_put_opener(IHTMLWindow2 *iface, VARIANT v)
376 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
377 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
378 return E_NOTIMPL;
381 static HRESULT WINAPI HTMLWindow2_get_opener(IHTMLWindow2 *iface, VARIANT *p)
383 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
384 FIXME("(%p)->(%p)\n", This, p);
385 return E_NOTIMPL;
388 static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigator **p)
390 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
392 TRACE("(%p)->(%p)\n", This, p);
394 *p = OmNavigator_Create();
395 return S_OK;
398 static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
400 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
401 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
402 return E_NOTIMPL;
405 static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
407 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
408 FIXME("(%p)->(%p)\n", This, p);
409 return E_NOTIMPL;
412 static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
414 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
415 FIXME("(%p)->(%p)\n", This, p);
416 return E_NOTIMPL;
419 static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
420 BSTR features, VARIANT_BOOL replace, IHTMLWindow2 **pomWindowResult)
422 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
423 FIXME("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
424 debugstr_w(features), replace, pomWindowResult);
425 return E_NOTIMPL;
428 static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p)
430 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
432 TRACE("(%p)->(%p)\n", This, p);
434 /* FIXME: We should return kind of proxy window here. */
435 IHTMLWindow2_AddRef(HTMLWINDOW2(This));
436 *p = HTMLWINDOW2(This);
437 return S_OK;
440 static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p)
442 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
443 FIXME("(%p)->(%p)\n", This, p);
444 return E_NOTIMPL;
447 static HRESULT WINAPI HTMLWindow2_get_window(IHTMLWindow2 *iface, IHTMLWindow2 **p)
449 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
451 TRACE("(%p)->(%p)\n", This, p);
453 /* FIXME: We should return kind of proxy window here. */
454 IHTMLWindow2_AddRef(HTMLWINDOW2(This));
455 *p = HTMLWINDOW2(This);
456 return S_OK;
459 static HRESULT WINAPI HTMLWindow2_navigate(IHTMLWindow2 *iface, BSTR url)
461 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
462 FIXME("(%p)->(%s)\n", This, debugstr_w(url));
463 return E_NOTIMPL;
466 static HRESULT WINAPI HTMLWindow2_put_onfocus(IHTMLWindow2 *iface, VARIANT v)
468 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
469 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
470 return E_NOTIMPL;
473 static HRESULT WINAPI HTMLWindow2_get_onfocus(IHTMLWindow2 *iface, VARIANT *p)
475 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
476 FIXME("(%p)->(%p)\n", This, p);
477 return E_NOTIMPL;
480 static HRESULT WINAPI HTMLWindow2_put_onblur(IHTMLWindow2 *iface, VARIANT v)
482 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
483 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
484 return E_NOTIMPL;
487 static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p)
489 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
490 FIXME("(%p)->(%p)\n", This, p);
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLWindow2_put_onload(IHTMLWindow2 *iface, VARIANT v)
496 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
497 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
498 return E_NOTIMPL;
501 static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
503 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
504 FIXME("(%p)->(%p)\n", This, p);
505 return E_NOTIMPL;
508 static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
510 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
511 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
512 return E_NOTIMPL;
515 static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
517 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
518 FIXME("(%p)->(%p)\n", This, p);
519 return E_NOTIMPL;
522 static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)
524 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
525 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
526 return E_NOTIMPL;
529 static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
531 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
532 FIXME("(%p)->(%p)\n", This, p);
533 return E_NOTIMPL;
536 static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v)
538 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
539 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
540 return E_NOTIMPL;
543 static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p)
545 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
546 FIXME("(%p)->(%p)\n", This, p);
547 return E_NOTIMPL;
550 static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v)
552 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
553 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
554 return E_NOTIMPL;
557 static HRESULT WINAPI HTMLWindow2_get_onerror(IHTMLWindow2 *iface, VARIANT *p)
559 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
560 FIXME("(%p)->(%p)\n", This, p);
561 return E_NOTIMPL;
564 static HRESULT WINAPI HTMLWindow2_put_onresize(IHTMLWindow2 *iface, VARIANT v)
566 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
567 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
568 return E_NOTIMPL;
571 static HRESULT WINAPI HTMLWindow2_get_onresize(IHTMLWindow2 *iface, VARIANT *p)
573 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
574 FIXME("(%p)->(%p)\n", This, p);
575 return E_NOTIMPL;
578 static HRESULT WINAPI HTMLWindow2_put_onscroll(IHTMLWindow2 *iface, VARIANT v)
580 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
581 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
582 return E_NOTIMPL;
585 static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p)
587 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
588 FIXME("(%p)->(%p)\n", This, p);
589 return E_NOTIMPL;
592 static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p)
594 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
596 TRACE("(%p)->(%p)\n", This, p);
598 if(This->doc) {
599 /* FIXME: We should return a wrapper object here */
600 *p = HTMLDOC(This->doc);
601 IHTMLDocument2_AddRef(*p);
602 }else {
603 *p = NULL;
606 return S_OK;
609 static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p)
611 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
613 TRACE("(%p)->(%p)\n", This, p);
615 if(This->event)
616 IHTMLEventObj_AddRef(This->event);
617 *p = This->event;
618 return S_OK;
621 static HRESULT WINAPI HTMLWindow2_get__newEnum(IHTMLWindow2 *iface, IUnknown **p)
623 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
624 FIXME("(%p)->(%p)\n", This, p);
625 return E_NOTIMPL;
628 static HRESULT WINAPI HTMLWindow2_showModalDialog(IHTMLWindow2 *iface, BSTR dialog,
629 VARIANT *varArgIn, VARIANT *varOptions, VARIANT *varArgOut)
631 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
632 FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(dialog), varArgIn, varOptions, varArgOut);
633 return E_NOTIMPL;
636 static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VARIANT helpArg,
637 BSTR features)
639 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
640 FIXME("(%p)->(%s v(%d) %s)\n", This, debugstr_w(helpURL), V_VT(&helpArg), debugstr_w(features));
641 return E_NOTIMPL;
644 static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p)
646 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
647 FIXME("(%p)->(%p)\n", This, p);
648 return E_NOTIMPL;
651 static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p)
653 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
655 TRACE("(%p)->(%p)\n", This, p);
657 if(!This->doc->option_factory)
658 This->doc->option_factory = HTMLOptionElementFactory_Create(This->doc);
660 *p = HTMLOPTFACTORY(This->doc->option_factory);
661 IHTMLOptionElementFactory_AddRef(*p);
663 return S_OK;
666 static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface)
668 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
669 FIXME("(%p)->()\n", This);
670 return E_NOTIMPL;
673 static HRESULT WINAPI HTMLWindow2_get_closed(IHTMLWindow2 *iface, VARIANT_BOOL *p)
675 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
676 FIXME("(%p)->(%p)\n", This, p);
677 return E_NOTIMPL;
680 static HRESULT WINAPI HTMLWindow2_blur(IHTMLWindow2 *iface)
682 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
683 FIXME("(%p)->()\n", This);
684 return E_NOTIMPL;
687 static HRESULT WINAPI HTMLWindow2_scroll(IHTMLWindow2 *iface, LONG x, LONG y)
689 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
690 FIXME("(%p)->(%d %d)\n", This, x, y);
691 return E_NOTIMPL;
694 static HRESULT WINAPI HTMLWindow2_get_clientInformation(IHTMLWindow2 *iface, IOmNavigator **p)
696 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
697 FIXME("(%p)->(%p)\n", This, p);
698 return E_NOTIMPL;
701 static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expression,
702 LONG msec, VARIANT *language, LONG *timerID)
704 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
705 VARIANT expr;
707 TRACE("(%p)->(%s %d %p %p)\n", This, debugstr_w(expression), msec, language, timerID);
709 V_VT(&expr) = VT_BSTR;
710 V_BSTR(&expr) = expression;
711 return IHTMLWindow3_setInterval(HTMLWINDOW3(This), &expr, msec, language, timerID);
714 static HRESULT WINAPI HTMLWindow2_clearInterval(IHTMLWindow2 *iface, LONG timerID)
716 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
718 TRACE("(%p)->(%d)\n", This, timerID);
720 return clear_task_timer(This->doc, TRUE, timerID);
723 static HRESULT WINAPI HTMLWindow2_put_offscreenBuffering(IHTMLWindow2 *iface, VARIANT v)
725 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
726 FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
727 return E_NOTIMPL;
730 static HRESULT WINAPI HTMLWindow2_get_offscreenBuffering(IHTMLWindow2 *iface, VARIANT *p)
732 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
733 FIXME("(%p)->(%p)\n", This, p);
734 return E_NOTIMPL;
737 static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BSTR language,
738 VARIANT *pvarRet)
740 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
741 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
742 return E_NOTIMPL;
745 static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
747 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
748 FIXME("(%p)->(%p)\n", This, String);
749 return E_NOTIMPL;
752 static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, LONG x, LONG y)
754 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
755 nsresult nsres;
757 TRACE("(%p)->(%d %d)\n", This, x, y);
759 nsres = nsIDOMWindow_ScrollBy(This->nswindow, x, y);
760 if(NS_FAILED(nsres))
761 ERR("ScrollBy failed: %08x\n", nsres);
763 return S_OK;
766 static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, LONG x, LONG y)
768 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
769 nsresult nsres;
771 TRACE("(%p)->(%d %d)\n", This, x, y);
773 nsres = nsIDOMWindow_ScrollTo(This->nswindow, x, y);
774 if(NS_FAILED(nsres))
775 ERR("ScrollTo failed: %08x\n", nsres);
777 return S_OK;
780 static HRESULT WINAPI HTMLWindow2_moveTo(IHTMLWindow2 *iface, LONG x, LONG y)
782 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
783 FIXME("(%p)->(%d %d)\n", This, x, y);
784 return E_NOTIMPL;
787 static HRESULT WINAPI HTMLWindow2_moveBy(IHTMLWindow2 *iface, LONG x, LONG y)
789 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
790 FIXME("(%p)->(%d %d)\n", This, x, y);
791 return E_NOTIMPL;
794 static HRESULT WINAPI HTMLWindow2_resizeTo(IHTMLWindow2 *iface, LONG x, LONG y)
796 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
797 FIXME("(%p)->(%d %d)\n", This, x, y);
798 return E_NOTIMPL;
801 static HRESULT WINAPI HTMLWindow2_resizeBy(IHTMLWindow2 *iface, LONG x, LONG y)
803 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
804 FIXME("(%p)->(%d %d)\n", This, x, y);
805 return E_NOTIMPL;
808 static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **p)
810 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
812 TRACE("(%p)->(%p)\n", This, p);
814 *p = NULL;
816 if(!This->doc->hostui)
817 return S_OK;
819 return IDocHostUIHandler_GetExternal(This->doc->hostui, p);
822 #undef HTMLWINDOW2_THIS
824 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = {
825 HTMLWindow2_QueryInterface,
826 HTMLWindow2_AddRef,
827 HTMLWindow2_Release,
828 HTMLWindow2_GetTypeInfoCount,
829 HTMLWindow2_GetTypeInfo,
830 HTMLWindow2_GetIDsOfNames,
831 HTMLWindow2_Invoke,
832 HTMLWindow2_item,
833 HTMLWindow2_get_length,
834 HTMLWindow2_get_frames,
835 HTMLWindow2_put_defaultStatus,
836 HTMLWindow2_get_defaultStatus,
837 HTMLWindow2_put_status,
838 HTMLWindow2_get_status,
839 HTMLWindow2_setTimeout,
840 HTMLWindow2_clearTimeout,
841 HTMLWindow2_alert,
842 HTMLWindow2_confirm,
843 HTMLWindow2_prompt,
844 HTMLWindow2_get_Image,
845 HTMLWindow2_get_location,
846 HTMLWindow2_get_history,
847 HTMLWindow2_close,
848 HTMLWindow2_put_opener,
849 HTMLWindow2_get_opener,
850 HTMLWindow2_get_navigator,
851 HTMLWindow2_put_name,
852 HTMLWindow2_get_name,
853 HTMLWindow2_get_parent,
854 HTMLWindow2_open,
855 HTMLWindow2_get_self,
856 HTMLWindow2_get_top,
857 HTMLWindow2_get_window,
858 HTMLWindow2_navigate,
859 HTMLWindow2_put_onfocus,
860 HTMLWindow2_get_onfocus,
861 HTMLWindow2_put_onblur,
862 HTMLWindow2_get_onblur,
863 HTMLWindow2_put_onload,
864 HTMLWindow2_get_onload,
865 HTMLWindow2_put_onbeforeunload,
866 HTMLWindow2_get_onbeforeunload,
867 HTMLWindow2_put_onunload,
868 HTMLWindow2_get_onunload,
869 HTMLWindow2_put_onhelp,
870 HTMLWindow2_get_onhelp,
871 HTMLWindow2_put_onerror,
872 HTMLWindow2_get_onerror,
873 HTMLWindow2_put_onresize,
874 HTMLWindow2_get_onresize,
875 HTMLWindow2_put_onscroll,
876 HTMLWindow2_get_onscroll,
877 HTMLWindow2_get_document,
878 HTMLWindow2_get_event,
879 HTMLWindow2_get__newEnum,
880 HTMLWindow2_showModalDialog,
881 HTMLWindow2_showHelp,
882 HTMLWindow2_get_screen,
883 HTMLWindow2_get_Option,
884 HTMLWindow2_focus,
885 HTMLWindow2_get_closed,
886 HTMLWindow2_blur,
887 HTMLWindow2_scroll,
888 HTMLWindow2_get_clientInformation,
889 HTMLWindow2_setInterval,
890 HTMLWindow2_clearInterval,
891 HTMLWindow2_put_offscreenBuffering,
892 HTMLWindow2_get_offscreenBuffering,
893 HTMLWindow2_execScript,
894 HTMLWindow2_toString,
895 HTMLWindow2_scrollBy,
896 HTMLWindow2_scrollTo,
897 HTMLWindow2_moveTo,
898 HTMLWindow2_moveBy,
899 HTMLWindow2_resizeTo,
900 HTMLWindow2_resizeBy,
901 HTMLWindow2_get_external
904 #define HTMLWINDOW3_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow3, iface)
906 static HRESULT WINAPI HTMLWindow3_QueryInterface(IHTMLWindow3 *iface, REFIID riid, void **ppv)
908 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
910 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv);
913 static ULONG WINAPI HTMLWindow3_AddRef(IHTMLWindow3 *iface)
915 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
917 return IHTMLWindow2_AddRef(HTMLWINDOW2(This));
920 static ULONG WINAPI HTMLWindow3_Release(IHTMLWindow3 *iface)
922 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
924 return IHTMLWindow2_Release(HTMLWINDOW2(This));
927 static HRESULT WINAPI HTMLWindow3_GetTypeInfoCount(IHTMLWindow3 *iface, UINT *pctinfo)
929 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
931 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
934 static HRESULT WINAPI HTMLWindow3_GetTypeInfo(IHTMLWindow3 *iface, UINT iTInfo,
935 LCID lcid, ITypeInfo **ppTInfo)
937 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
939 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
942 static HRESULT WINAPI HTMLWindow3_GetIDsOfNames(IHTMLWindow3 *iface, REFIID riid,
943 LPOLESTR *rgszNames, UINT cNames,
944 LCID lcid, DISPID *rgDispId)
946 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
948 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
951 static HRESULT WINAPI HTMLWindow3_Invoke(IHTMLWindow3 *iface, DISPID dispIdMember,
952 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
953 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
955 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
957 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
958 pVarResult, pExcepInfo, puArgErr);
961 static HRESULT WINAPI HTMLWindow3_get_screenLeft(IHTMLWindow3 *iface, LONG *p)
963 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
964 FIXME("(%p)->(%p)\n", This, p);
965 return E_NOTIMPL;
968 static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, LONG *p)
970 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
971 FIXME("(%p)->(%p)\n", This, p);
972 return E_NOTIMPL;
975 static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp, VARIANT_BOOL *pfResult)
977 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
978 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
979 return E_NOTIMPL;
982 static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
984 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
985 FIXME("(%p)->()\n", This);
986 return E_NOTIMPL;
989 static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
990 BOOL interval, LONG *timer_id)
992 IDispatch *disp = NULL;
994 switch(V_VT(expr)) {
995 case VT_DISPATCH:
996 disp = V_DISPATCH(expr);
997 IDispatch_AddRef(disp);
998 break;
1000 case VT_BSTR:
1001 disp = script_parse_event(This->doc, V_BSTR(expr));
1002 break;
1004 default:
1005 FIXME("unimplemented vt=%d\n", V_VT(expr));
1006 return E_NOTIMPL;
1009 if(!disp)
1010 return E_FAIL;
1012 *timer_id = set_task_timer(This->doc, msec, interval, disp);
1013 IDispatch_Release(disp);
1015 return S_OK;
1018 static HRESULT WINAPI HTMLWindow3_setTimeout(IHTMLWindow3 *iface, VARIANT *expression, LONG msec,
1019 VARIANT *language, LONG *timerID)
1021 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1023 TRACE("(%p)->(%p(%d) %d %p %p)\n", This, expression, V_VT(expression), msec, language, timerID);
1025 return window_set_timer(This, expression, msec, language, FALSE, timerID);
1028 static HRESULT WINAPI HTMLWindow3_setInterval(IHTMLWindow3 *iface, VARIANT *expression, LONG msec,
1029 VARIANT *language, LONG *timerID)
1031 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1033 TRACE("(%p)->(%p %d %p %p)\n", This, expression, msec, language, timerID);
1035 return window_set_timer(This, expression, msec, language, TRUE, timerID);
1038 static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface)
1040 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1041 FIXME("(%p)\n", This);
1042 return E_NOTIMPL;
1045 static HRESULT WINAPI HTMLWindow3_put_onbeforeprint(IHTMLWindow3 *iface, VARIANT v)
1047 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1048 FIXME("(%p)->()\n", This);
1049 return E_NOTIMPL;
1052 static HRESULT WINAPI HTMLWindow3_get_onbeforeprint(IHTMLWindow3 *iface, VARIANT *p)
1054 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1055 FIXME("(%p)->(%p)\n", This, p);
1056 return E_NOTIMPL;
1059 static HRESULT WINAPI HTMLWindow3_put_onafterprint(IHTMLWindow3 *iface, VARIANT v)
1061 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1062 FIXME("(%p)->()\n", This);
1063 return E_NOTIMPL;
1066 static HRESULT WINAPI HTMLWindow3_get_onafterprint(IHTMLWindow3 *iface, VARIANT *p)
1068 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1069 FIXME("(%p)->(%p)\n", This, p);
1070 return E_NOTIMPL;
1073 static HRESULT WINAPI HTMLWindow3_get_clipboardData(IHTMLWindow3 *iface, IHTMLDataTransfer **p)
1075 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1076 FIXME("(%p)->(%p)\n", This, p);
1077 return E_NOTIMPL;
1080 static HRESULT WINAPI HTMLWindow3_showModelessDialog(IHTMLWindow3 *iface, BSTR url,
1081 VARIANT *varArgIn, VARIANT *options, IHTMLWindow2 **pDialog)
1083 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1084 FIXME("(%p)->(%s %p %p %p)\n", This, debugstr_w(url), varArgIn, options, pDialog);
1085 return E_NOTIMPL;
1088 #undef HTMLWINDOW3_THIS
1090 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl = {
1091 HTMLWindow3_QueryInterface,
1092 HTMLWindow3_AddRef,
1093 HTMLWindow3_Release,
1094 HTMLWindow3_GetTypeInfoCount,
1095 HTMLWindow3_GetTypeInfo,
1096 HTMLWindow3_GetIDsOfNames,
1097 HTMLWindow3_Invoke,
1098 HTMLWindow3_get_screenLeft,
1099 HTMLWindow3_get_screenTop,
1100 HTMLWindow3_attachEvent,
1101 HTMLWindow3_detachEvent,
1102 HTMLWindow3_setTimeout,
1103 HTMLWindow3_setInterval,
1104 HTMLWindow3_print,
1105 HTMLWindow3_put_onbeforeprint,
1106 HTMLWindow3_get_onbeforeprint,
1107 HTMLWindow3_put_onafterprint,
1108 HTMLWindow3_get_onafterprint,
1109 HTMLWindow3_get_clipboardData,
1110 HTMLWindow3_showModelessDialog
1113 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLWindow, IDispatchEx, iface)
1115 static HRESULT WINAPI WindowDispEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
1117 HTMLWindow *This = DISPEX_THIS(iface);
1119 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv);
1122 static ULONG WINAPI WindowDispEx_AddRef(IDispatchEx *iface)
1124 HTMLWindow *This = DISPEX_THIS(iface);
1126 return IHTMLWindow2_AddRef(HTMLWINDOW2(This));
1129 static ULONG WINAPI WindowDispEx_Release(IDispatchEx *iface)
1131 HTMLWindow *This = DISPEX_THIS(iface);
1133 return IHTMLWindow2_Release(HTMLWINDOW2(This));
1136 static HRESULT WINAPI WindowDispEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
1138 HTMLWindow *This = DISPEX_THIS(iface);
1140 TRACE("(%p)->(%p)\n", This, pctinfo);
1142 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
1145 static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
1146 LCID lcid, ITypeInfo **ppTInfo)
1148 HTMLWindow *This = DISPEX_THIS(iface);
1150 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1152 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
1155 static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
1156 LPOLESTR *rgszNames, UINT cNames,
1157 LCID lcid, DISPID *rgDispId)
1159 HTMLWindow *This = DISPEX_THIS(iface);
1161 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1162 lcid, rgDispId);
1164 /* FIXME: Use script dispatch */
1166 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
1169 static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
1170 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1171 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1173 HTMLWindow *This = DISPEX_THIS(iface);
1175 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1176 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1178 /* FIXME: Use script dispatch */
1180 return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, wFlags, pDispParams,
1181 pVarResult, pExcepInfo, puArgErr);
1184 static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
1186 HTMLWindow *This = DISPEX_THIS(iface);
1188 TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
1190 return IDispatchEx_GetDispID(DISPATCHEX(&This->dispex), bstrName, grfdex, pid);
1193 static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
1194 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
1196 HTMLWindow *This = DISPEX_THIS(iface);
1198 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1200 return IDispatchEx_InvokeEx(DISPATCHEX(&This->dispex), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
1203 static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
1205 HTMLWindow *This = DISPEX_THIS(iface);
1207 TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
1209 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This->dispex), bstrName, grfdex);
1212 static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
1214 HTMLWindow *This = DISPEX_THIS(iface);
1216 TRACE("(%p)->(%x)\n", This, id);
1218 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This->dispex), id);
1221 static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
1223 HTMLWindow *This = DISPEX_THIS(iface);
1225 TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
1227 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This->dispex), id, grfdexFetch, pgrfdex);
1230 static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
1232 HTMLWindow *This = DISPEX_THIS(iface);
1234 TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
1236 return IDispatchEx_GetMemberName(DISPATCHEX(&This->dispex), id, pbstrName);
1239 static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
1241 HTMLWindow *This = DISPEX_THIS(iface);
1243 TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
1245 return IDispatchEx_GetNextDispID(DISPATCHEX(&This->dispex), grfdex, id, pid);
1248 static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
1250 HTMLWindow *This = DISPEX_THIS(iface);
1252 TRACE("(%p)->(%p)\n", This, ppunk);
1254 *ppunk = NULL;
1255 return S_OK;
1258 #undef DISPEX_THIS
1260 static const IDispatchExVtbl WindowDispExVtbl = {
1261 WindowDispEx_QueryInterface,
1262 WindowDispEx_AddRef,
1263 WindowDispEx_Release,
1264 WindowDispEx_GetTypeInfoCount,
1265 WindowDispEx_GetTypeInfo,
1266 WindowDispEx_GetIDsOfNames,
1267 WindowDispEx_Invoke,
1268 WindowDispEx_GetDispID,
1269 WindowDispEx_InvokeEx,
1270 WindowDispEx_DeleteMemberByName,
1271 WindowDispEx_DeleteMemberByDispID,
1272 WindowDispEx_GetMemberProperties,
1273 WindowDispEx_GetMemberName,
1274 WindowDispEx_GetNextDispID,
1275 WindowDispEx_GetNameSpaceParent
1278 static const tid_t HTMLWindow_iface_tids[] = {
1279 IHTMLWindow2_tid,
1280 IHTMLWindow3_tid,
1283 static dispex_static_data_t HTMLWindow_dispex = {
1284 NULL,
1285 DispHTMLWindow2_tid,
1286 NULL,
1287 HTMLWindow_iface_tids
1290 HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
1292 HTMLWindow *window;
1294 window = heap_alloc_zero(sizeof(HTMLWindow));
1295 if(!window)
1296 return E_OUTOFMEMORY;
1298 window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
1299 window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
1300 window->lpIDispatchExVtbl = &WindowDispExVtbl;
1301 window->ref = 1;
1302 window->doc = doc;
1304 init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
1306 if(nswindow) {
1307 nsIDOMWindow_AddRef(nswindow);
1308 window->nswindow = nswindow;
1311 list_add_head(&window_list, &window->entry);
1313 *ret = window;
1314 return S_OK;
1317 HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
1319 HTMLWindow *iter;
1321 LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) {
1322 if(iter->nswindow == nswindow)
1323 return iter;
1326 return NULL;