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
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.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);
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;
69 IUnknown_AddRef((IUnknown*)*ppv);
73 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
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);
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);
95 list_remove(&This->entry);
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);
143 static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
145 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
146 FIXME("(%p)->(%p)\n", This, p);
150 static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
152 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
153 FIXME("(%p)->(%p)\n", This, p);
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));
164 static HRESULT WINAPI HTMLWindow2_get_defaultStatus(IHTMLWindow2 *iface, BSTR *p)
166 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
167 FIXME("(%p)->(%p)\n", This, p);
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));
178 static HRESULT WINAPI HTMLWindow2_get_status(IHTMLWindow2 *iface, BSTR *p)
180 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
181 FIXME("(%p)->(%p)\n", This, p);
185 static HRESULT WINAPI HTMLWindow2_setTimeout(IHTMLWindow2 *iface, BSTR expression,
186 LONG msec, VARIANT *language, LONG *timerID)
188 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
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);
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());
221 MessageBoxW(This->doc->hwnd, message, wszTitle, MB_ICONWARNING);
225 static HRESULT WINAPI HTMLWindow2_confirm(IHTMLWindow2 *iface, BSTR message,
226 VARIANT_BOOL *confirmed)
228 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
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;
242 if(MessageBoxW(This->doc->hwnd, message, wszTitle,
243 MB_OKCANCEL|MB_ICONQUESTION)==IDOK)
244 *confirmed = VARIANT_TRUE;
245 else *confirmed = VARIANT_FALSE;
257 static INT_PTR CALLBACK prompt_dlgproc(HWND hwnd, UINT msg,
258 WPARAM wparam, LPARAM lparam)
264 prompt_arg *arg = (prompt_arg*)lparam;
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);
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);
283 case MAKEWPARAM(IDCANCEL, BN_CLICKED):
284 EndDialog(hwnd, wparam);
286 case MAKEWPARAM(IDOK, BN_CLICKED):
289 (prompt_arg*)GetWindowLongPtrW(hwnd, DWLP_USER);
290 HWND hwndPrompt = GetDlgItem(hwnd, ID_PROMPT_EDIT);
291 INT len = GetWindowTextLengthW(hwndPrompt);
295 EndDialog(hwnd, wparam);
299 V_VT(arg->textdata) = VT_BSTR;
300 if(!len && !arg->dststr)
301 V_BSTR(arg->textdata) = NULL;
304 V_BSTR(arg->textdata) = SysAllocStringLen(NULL, len);
305 GetWindowTextW(hwndPrompt, V_BSTR(arg->textdata), len+1);
307 EndDialog(hwnd, wparam);
313 EndDialog(hwnd, IDCANCEL);
320 static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
321 BSTR dststr, VARIANT *textdata)
323 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
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;
332 arg.textdata = textdata;
334 DialogBoxParamW(hInst, MAKEINTRESOURCEW(ID_PROMPT_DIALOG),
335 This->doc->hwnd, prompt_dlgproc, (LPARAM)&arg);
339 static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **p)
341 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
342 FIXME("(%p)->(%p)\n", This, p);
346 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
348 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
350 TRACE("(%p)->(%p)\n", This, p);
353 FIXME("This->doc is NULL\n");
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);
367 static HRESULT WINAPI HTMLWindow2_close(IHTMLWindow2 *iface)
369 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
370 FIXME("(%p)->()\n", This);
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));
381 static HRESULT WINAPI HTMLWindow2_get_opener(IHTMLWindow2 *iface, VARIANT *p)
383 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
384 FIXME("(%p)->(%p)\n", This, p);
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();
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));
405 static HRESULT WINAPI HTMLWindow2_get_name(IHTMLWindow2 *iface, BSTR *p)
407 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
408 FIXME("(%p)->(%p)\n", This, p);
412 static HRESULT WINAPI HTMLWindow2_get_parent(IHTMLWindow2 *iface, IHTMLWindow2 **p)
414 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
415 FIXME("(%p)->(%p)\n", This, p);
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);
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);
440 static HRESULT WINAPI HTMLWindow2_get_top(IHTMLWindow2 *iface, IHTMLWindow2 **p)
442 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
443 FIXME("(%p)->(%p)\n", This, p);
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);
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));
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));
473 static HRESULT WINAPI HTMLWindow2_get_onfocus(IHTMLWindow2 *iface, VARIANT *p)
475 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
476 FIXME("(%p)->(%p)\n", This, p);
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));
487 static HRESULT WINAPI HTMLWindow2_get_onblur(IHTMLWindow2 *iface, VARIANT *p)
489 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
490 FIXME("(%p)->(%p)\n", This, p);
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));
501 static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
503 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
504 FIXME("(%p)->(%p)\n", This, p);
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));
515 static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
517 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
518 FIXME("(%p)->(%p)\n", This, p);
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));
529 static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
531 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
532 FIXME("(%p)->(%p)\n", This, p);
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));
543 static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p)
545 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
546 FIXME("(%p)->(%p)\n", This, p);
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));
557 static HRESULT WINAPI HTMLWindow2_get_onerror(IHTMLWindow2 *iface, VARIANT *p)
559 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
560 FIXME("(%p)->(%p)\n", This, p);
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));
571 static HRESULT WINAPI HTMLWindow2_get_onresize(IHTMLWindow2 *iface, VARIANT *p)
573 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
574 FIXME("(%p)->(%p)\n", This, p);
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));
585 static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p)
587 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
588 FIXME("(%p)->(%p)\n", This, p);
592 static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p)
594 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
596 TRACE("(%p)->(%p)\n", This, p);
599 /* FIXME: We should return a wrapper object here */
600 *p = HTMLDOC(This->doc);
601 IHTMLDocument2_AddRef(*p);
609 static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p)
611 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
613 TRACE("(%p)->(%p)\n", This, p);
616 IHTMLEventObj_AddRef(This->event);
621 static HRESULT WINAPI HTMLWindow2_get__newEnum(IHTMLWindow2 *iface, IUnknown **p)
623 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
624 FIXME("(%p)->(%p)\n", This, p);
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);
636 static HRESULT WINAPI HTMLWindow2_showHelp(IHTMLWindow2 *iface, BSTR helpURL, VARIANT helpArg,
639 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
640 FIXME("(%p)->(%s v(%d) %s)\n", This, debugstr_w(helpURL), V_VT(&helpArg), debugstr_w(features));
644 static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **p)
646 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
647 FIXME("(%p)->(%p)\n", This, p);
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);
666 static HRESULT WINAPI HTMLWindow2_focus(IHTMLWindow2 *iface)
668 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
669 FIXME("(%p)->()\n", This);
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);
680 static HRESULT WINAPI HTMLWindow2_blur(IHTMLWindow2 *iface)
682 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
683 FIXME("(%p)->()\n", This);
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);
694 static HRESULT WINAPI HTMLWindow2_get_clientInformation(IHTMLWindow2 *iface, IOmNavigator **p)
696 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
697 FIXME("(%p)->(%p)\n", This, p);
701 static HRESULT WINAPI HTMLWindow2_setInterval(IHTMLWindow2 *iface, BSTR expression,
702 LONG msec, VARIANT *language, LONG *timerID)
704 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
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));
730 static HRESULT WINAPI HTMLWindow2_get_offscreenBuffering(IHTMLWindow2 *iface, VARIANT *p)
732 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
733 FIXME("(%p)->(%p)\n", This, p);
737 static HRESULT WINAPI HTMLWindow2_execScript(IHTMLWindow2 *iface, BSTR scode, BSTR language,
740 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
741 FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(scode), debugstr_w(language), pvarRet);
745 static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String)
747 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
748 FIXME("(%p)->(%p)\n", This, String);
752 static HRESULT WINAPI HTMLWindow2_scrollBy(IHTMLWindow2 *iface, LONG x, LONG y)
754 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
757 TRACE("(%p)->(%d %d)\n", This, x, y);
759 nsres = nsIDOMWindow_ScrollBy(This->nswindow, x, y);
761 ERR("ScrollBy failed: %08x\n", nsres);
766 static HRESULT WINAPI HTMLWindow2_scrollTo(IHTMLWindow2 *iface, LONG x, LONG y)
768 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
771 TRACE("(%p)->(%d %d)\n", This, x, y);
773 nsres = nsIDOMWindow_ScrollTo(This->nswindow, x, y);
775 ERR("ScrollTo failed: %08x\n", nsres);
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);
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);
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);
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);
808 static HRESULT WINAPI HTMLWindow2_get_external(IHTMLWindow2 *iface, IDispatch **p)
810 HTMLWindow *This = HTMLWINDOW2_THIS(iface);
812 TRACE("(%p)->(%p)\n", This, p);
816 if(!This->doc->hostui)
819 return IDocHostUIHandler_GetExternal(This->doc->hostui, p);
822 #undef HTMLWINDOW2_THIS
824 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl = {
825 HTMLWindow2_QueryInterface,
828 HTMLWindow2_GetTypeInfoCount,
829 HTMLWindow2_GetTypeInfo,
830 HTMLWindow2_GetIDsOfNames,
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,
844 HTMLWindow2_get_Image,
845 HTMLWindow2_get_location,
846 HTMLWindow2_get_history,
848 HTMLWindow2_put_opener,
849 HTMLWindow2_get_opener,
850 HTMLWindow2_get_navigator,
851 HTMLWindow2_put_name,
852 HTMLWindow2_get_name,
853 HTMLWindow2_get_parent,
855 HTMLWindow2_get_self,
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,
885 HTMLWindow2_get_closed,
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,
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);
968 static HRESULT WINAPI HTMLWindow3_get_screenTop(IHTMLWindow3 *iface, LONG *p)
970 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
971 FIXME("(%p)->(%p)\n", This, p);
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);
982 static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
984 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
985 FIXME("(%p)->()\n", This);
989 static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
990 BOOL interval, LONG *timer_id)
992 IDispatch *disp = NULL;
996 disp = V_DISPATCH(expr);
997 IDispatch_AddRef(disp);
1001 disp = script_parse_event(This->doc, V_BSTR(expr));
1005 FIXME("unimplemented vt=%d\n", V_VT(expr));
1012 *timer_id = set_task_timer(This->doc, msec, interval, disp);
1013 IDispatch_Release(disp);
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);
1045 static HRESULT WINAPI HTMLWindow3_put_onbeforeprint(IHTMLWindow3 *iface, VARIANT v)
1047 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1048 FIXME("(%p)->()\n", This);
1052 static HRESULT WINAPI HTMLWindow3_get_onbeforeprint(IHTMLWindow3 *iface, VARIANT *p)
1054 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1055 FIXME("(%p)->(%p)\n", This, p);
1059 static HRESULT WINAPI HTMLWindow3_put_onafterprint(IHTMLWindow3 *iface, VARIANT v)
1061 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1062 FIXME("(%p)->()\n", This);
1066 static HRESULT WINAPI HTMLWindow3_get_onafterprint(IHTMLWindow3 *iface, VARIANT *p)
1068 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1069 FIXME("(%p)->(%p)\n", This, p);
1073 static HRESULT WINAPI HTMLWindow3_get_clipboardData(IHTMLWindow3 *iface, IHTMLDataTransfer **p)
1075 HTMLWindow *This = HTMLWINDOW3_THIS(iface);
1076 FIXME("(%p)->(%p)\n", This, p);
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);
1088 #undef HTMLWINDOW3_THIS
1090 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl = {
1091 HTMLWindow3_QueryInterface,
1093 HTMLWindow3_Release,
1094 HTMLWindow3_GetTypeInfoCount,
1095 HTMLWindow3_GetTypeInfo,
1096 HTMLWindow3_GetIDsOfNames,
1098 HTMLWindow3_get_screenLeft,
1099 HTMLWindow3_get_screenTop,
1100 HTMLWindow3_attachEvent,
1101 HTMLWindow3_detachEvent,
1102 HTMLWindow3_setTimeout,
1103 HTMLWindow3_setInterval,
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,
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);
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[] = {
1283 static dispex_static_data_t HTMLWindow_dispex = {
1285 DispHTMLWindow2_tid,
1287 HTMLWindow_iface_tids
1290 HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
1294 window = heap_alloc_zero(sizeof(HTMLWindow));
1296 return E_OUTOFMEMORY;
1298 window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
1299 window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
1300 window->lpIDispatchExVtbl = &WindowDispExVtbl;
1304 init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
1307 nsIDOMWindow_AddRef(nswindow);
1308 window->nswindow = nswindow;
1311 list_add_head(&window_list, &window->entry);
1317 HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
1321 LIST_FOR_EACH_ENTRY(iter, &window_list, HTMLWindow, entry) {
1322 if(iter->nswindow == nswindow)