The IHTMLWindow2 interface provides access to the window object, which represents an open window in the browser.
IHTMLWindow2 Methods
alert Displays an Alert dialog box with a message and an OK button. blur Causes the window to lose focus and fires the onblur event. clearInterval Cancels a repeated evaluation of an expression that was set with the setInterval method. clearTimeout Cancels a time-out that was set with the setTimeout method. close Closes the current browser window. confirm Displays a Confirm dialog box with the specified message, and OK and Cancel buttons. execScript Executes the specified script. focus Causes the window to receive the input focus and execute the code, if any, associated with the onfocus event. get__newEnum Retrieves an OLE enumeration interface. This will enumerate over the frames collection of this window. get_clientInformation Retrieves an interface pointer to a navigator object that represents the browser. get_closed Retrieves a value that indicates whether the window is closed. get_defaultStatus Retrieves the default message displayed in the status bar at the bottom of the window. get_document Retrieves an interface pointer to the document object for the document that the browser is displaying. get_event Retrieves an interface pointer to the event object that contains information relevant to the most recent event. get_external Retrieves external access to an additional object model provided by host applications of the Microsoft® Internet Explorer browser components. get_frames Retrieves an interface pointer to a zero-based collection of all the FRAME elements in an HTML document, if the document contains the FRAMESET element. get_history Retrieves an interface pointer to a history object that contains information about all the URLs that the client has visited. get_Image Returns an IHTMLImageElementFactory pointer that is used to create an offscreen image. get_location Retrieves an interface pointer to a location object. get_name Retrieves the name of the window. get_navigator Retrieves an interface pointer to a navigator object that represents the browser. get_offscreenBuffering Retrieves the value that indicates whether an offscreen buffer is being used. get_onbeforeunload Retrieves a pointer to the event handler function associated with the onbeforeunload event before a window element is unloaded. get_onblur Retrieves a pointer to the event handler function associated with the onblur event when the window element loses the focus. get_onerror Retrieves a pointer to the event handler function associated with the onerror event on the window element. get_onfocus Retrieves a pointer to the event handler function associated with the onfocus event on the window element. get_onhelp Retrieves a pointer to the event handler function associated with the onhelp event on the window element. get_onload Retrieves a pointer to the event handler function that is executed immediately after the browser loads the given object. get_onresize Retrieves a pointer to the event handler function associated with the onresize event of the window. get_onscroll Retrieves a pointer to the event handler function that is executed when the scroll box is repositioned. get_onunload Retrieves a pointer to the event handler function that is executed immediately before the page is unloaded. get_opener Retrieves a reference to the window that created the current window. get_Option Retrieves an interface pointer to a factory object that you can use to create OPTION elements. get_parent Retrieves an interface pointer to the parent object in the object hierarchy. get_screen Retrieves an interface pointer to a screen object that provides information about the client's screen and rendering abilities get_self Retrieves an interface pointer to the current window. get_status Retrieves the message displayed in the status bar at the bottom of the window. get_top Retrieves an interface pointer to the topmost ancestor window, which is the current window's own parent. get_window Retrieves an interface pointer to the current window. moveBy Moves the window by an increment. moveTo Moves the window to a specified coordinates. navigate Causes the browser to browse to the location specified by the URL. open Opens a new Web browser window. prompt Displays a Prompt dialog box with a message, an input field, and OK and Cancel buttons. put_defaultStatus Sets the default message displayed in the status bar at the bottom of the window. put_name Sets the name of the window. put_offscreenBuffering Sets the value that indicates whether to use an offscreen buffer. put_onbeforeunload Sets a pointer to the event handler function associated with the onbeforeunload event before a window element is unloaded. put_onblur Sets a pointer to the event handler function associated with the onblur event when the window element loses the focus. put_onerror Sets a pointer to the event handler function associated with the onerror event on the window element. put_onfocus Sets a pointer to the event handler function associated with the onfocus event on the window element. put_onhelp Sets a pointer to the event handler function associated with the onhelp event on the window element. put_onload Sets a pointer to the event handler function associated with the onload event on the window element. put_onresize Sets a pointer to the event handler function associated with the onresize event of the window. put_onscroll Specifies code to execute when the scroll box is repositioned. put_onunload Specifies code to execute immediately before the page is unloaded. put_opener Sets a reference to the window that created the current window. put_status Sets the message displayed in the status bar at the bottom of the window. resizeBy Changes the size of the window by an increment. resizeTo Changes the size of the window to a specified point. scroll Scrolls the window to the specified x and y offset relative to the entire document. scrollBy Scrolls the document horizontally by the x value provided, and scrolls the document vertically by the y value provided. scrollTo Given the area specified as (X,Y) in document coordinates, scrolls the document to that position. setInterval Calls a function repeatedly, or evaluates an expression after a specified number of milliseconds has elapsed. setTimeout Evaluates an expression after a specified number of milliseconds has elapsed. showHelp Displays a help file. showModalDialog Displays an HTML dialog box. toString Retrieves a string representation of the window object.
Interface Information
Implementation System (Mshtml.dll) Inherits from IDispatch Header and IDL files Mshtml.h, Mshtml.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0
Windows CE
For Microsoft® Windows® CE only, programmatic access to documents in windows created with the open method is not supported. Additionally, all windows are opened full screen.
Windows CE Use version 2.12 and later Minimum availability Internet Explorer 4.0
Remarks
The window object is used to retrieve information about the state of the window. It also is used to gain access to the document in the window, to the events that occur in the window, and to features of the browser that affect the window.
Typically, the browser creates one window object when it opens an HTML document. However, if a document defines one or more frames (that is, contains one or more FRAME or IFRAME tags), the browser creates one window object for the original document and one additional window object for each frame.
These additional objects are child windows of the original window and can be affected by actions that occur in the original. For example, closing the original window causes all child windows to close. You can also create new windows (and corresponding window objects) by using methods such as open and showModalDialog.