
This reference contains the following sections:
This section describes the new IWebBrowser2 interface that replaces the IWebBrowser and IWebBrowserApp interfaces from previous releases.
IWebBrowser2 designates an interface that allows applications to implement an instance of the WebBrowser control in an application (ActiveX Control) or control an instance of the Internet Explorer application (OLE Automation). For methods applicable to the Internet Explorer object only, the description section in the following table uses the "Internet Explorer only" notation, and throughout the reference sections the "Applies To" heading also indicates which object (WebBrowser or Internet Explorer) that method applies to. The Exdisp.h file defines all the WebBrowser interfaces as well as the GUIDs (globally unique identifiers).
Methods in Vtable Order
| IWebBrowser2 methods | Description |
| GoBack | Navigates to the previous item in the history list. |
| GoForward | Navigates to the next item in the history list. |
| GoHome | Navigates to the current home or start page. |
| GoSearch | Navigates to the current search page. |
| Navigate | Navigates to a resource identified by a Universal Resource Locator (URL). |
| Refresh | Reloads the current file. |
| Refresh2 | Reloads the current file and optionally prevents the "pragma:nocache" header from being sent. |
| Stop | Stops opening a file. |
| get_Application | Returns an application object representing the application that contains the current instance of the Internet Explorer application. |
| get_Parent | Returns the automation object. |
| get_Container | Returns the container of the WebBrowser control. |
| get_Document | Returns the active document. |
| get_TopLevelContainer | Returns a value indicating whether the current object is the top-level container of the WebBrowser control. |
| get_Type | Returns the type name of the document object. |
| get_Left | Returns the screen coordinate of the left edge of the Internet Explorer main window. |
| put_Left | Sets the horizontal position of the Internet Explorer main window. |
| get_Top | Returns the screen coordinate of the top edge of the Internet Explorer main window. |
| put_Top | Sets the vertical position of the Internet Explorer main window. |
| get_Width | Returns the width of the Internet Explorer main window. |
| put_Width | Sets the width of the Internet Explorer main window. |
| get_Height | Returns the height of the Internet Explorer main window. |
| put_Height | Sets the height of the Internet Explorer main window. |
| get_LocationName | Returns the name of the resource that WebBrowser is currently displaying. |
| get_LocationURL | Returns the URL of the resource that WebBrowser is currently displaying. |
| get_Busy | Returns a value indicating whether a download or other activity is still in progress. |
| Quit | Closes the Internet Explorer application. (Internet Explorer only) |
| ClientToWindow | Converts the client coordinates of a point to window coordinates. (Internet Explorer only) |
| PutProperty | Sets the value of a property associated with the given object. (Internet Explorer only) |
| GetProperty | Retrieves the current value of a property associated with the given object. (Internet Explorer only) |
| get_Name | Returns the name of the object that contains the WebBrowser control used by Internet Explorer. (Internet Explorer only) |
| get_HWND | Returns the window handle to the Internet Explorer main window. (Internet Explorer only) |
| get_FullName | Returns the full path of the file that Internet Explorer is currently displaying. (Internet Explorer only) |
| get_Path | Returns a string that evaluates to the full path of the resource that Internet Explorer is currently displaying. (Internet Explorer only) |
| get_Visible | Returns a value indicating whether the object is visible or hidden. |
| put_Visible | Sets a value indicating whether the object is visible or hidden. |
| get_StatusBar | Returns a value that indicates whether the status bar is visible. |
| put_StatusBar | Sets a value that determines whether the status bar is visible. |
| get_StatusText | Returns the text of the status bar. |
| put_StatusText | Sets the text for the status bar. |
| get_ToolBar | Returns a value that indicates whether the toolbar is visible. |
| put_ToolBar | Sets a value that determines whether the toolbar is visible. |
| get_MenuBar | Returns a value that indicates whether the menu bar is visible. |
| put_MenuBar | Sets a value that determines whether the menu bar is visible. |
| get_FullScreen | Returns a value indicating whether Internet Explorer is in full-screen or normal window mode. |
| put_FullScreen | Sets a value that determines whether Internet Explorer is in full-screen or normal window mode. |
| Navigate2 | Navigates to a resource identified by a pointer to an item identifier list (PIDL). |
| QueryStatusWB | Queries the object for status of commands. |
| ExecWB | Executes a command. |
| ShowBrowserBar | Shows or hides a specified browser bar. |
| get_ReadyState | Returns a standard OLE ReadyState bindable property for the WebBrowser control. |
| get_Offline | Returns a value that determines whether the control is offline. |
| put_Offline | Sets a value that determines whether the control is offline. |
| get_Silent | Returns a value indicating whether any dialog boxes can be shown. |
| put_Silent | Sets a value indicating whether any dialog boxes can be shown. |
| get_RegisterAsBrowser | Returns a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution. |
| put_RegisterAsBrowser | Sets a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution. |
| get_RegisterAsDropTarget | Returns a value indicating whether the WebBrowser control is registered as a drop target for navigation. |
| put_RegisterAsDropTarget | Sets a value indicating whether the WebBrowser control is registered as a drop target for navigation. |
| get_TheaterMode | Retrieves a value indicating whether the WebBrowser control is in theater mode. |
| put_TheaterMode | Sets a value indicating whether the WebBrowser control is in theater mode. |
| get_AddressBar | Determines if the Internet Explorer object's address bar is visible. |
| put_AddressBar | Shows or hides the Internet Explorer object's address bar. |
| get_Resizable | Retrieves the Internet Explorer object's resizable property. |
| put_Resizable | Sets the Internet Explorer object's resizable property. |
HRESULT ClientToWindow(
int FAR* pcx,
int FAR* pcy
);
Converts the client coordinates of a point to window coordinates. Client coordinates are relative to the upper-left corner of the client area; window coordinates are relative to the upper-left corner of a window.
Applies To
Internet Explorer
HRESULT ExecWB(
[in] OLECMDID cmdID,
[in] OLECMDEXECOPT cmdexecopt,
[in] VARIANT * pvaIn,
[out, in] VARIANT * pvaOut)
Implements a wrapper that allows you to execute a command on an OLE object using the IOleCommandTarget::Exec method.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::QueryStatusWB
HRESULT GetProperty(
BSTR szProperty,
VARIANT FAR* pvtValue
);
Retrieves the value of a property associated with the given object.
Applies To
Internet Explorer
See also IWebBrowser2::PutProperty
HRESULT GoBack(void);
Navigates backward one item in the history list.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::GoForward, IWebBrowser2::GoHome, IWebBrowser2::GoSearch
HRESULT GoForward(void);
Navigates forward one item in the history list.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::GoBack, IWebBrowser2::GoHome, IWebBrowser2::GoSearch
HRESULT GoHome(void);
Navigates to the current home or start page, as specified in the Internet Explorer Options dialog box and Internet Control Panel.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::GoBack, IWebBrowser2::GoForward, IWebBrowser2::GoSearch
HRESULT GoSearch(void);
Navigates to the current search page, as specified in the Internet Explorer Options dialog box and Internet Control Panel.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::GoBack, IWebBrowser2::GoForward, IWebBrowser2::GoHome
HRESULT IWebBrowser2::Navigate(
BSTR URL,
VARIANT FAR* Flags,
VARIANT FAR* TargetFrameName,
VARIANT FAR* PostData,
VARIANT FAR* Headers,
);
Navigates to a resource identified by a Uniform Resource Locator (URL) or to the file identified by a full path.
| S_OK | The operation was successful. |
| E_INVALIDARG | One or more parameters are invalid. |
| E_OUTOFMEMORY | Out of memory. |
The post data specified by PostData is passed as a SAFEARRAY structure. The variant should be of type VT_ARRAY and point to a SAFEARRAY. The SAFEARRAY should be of element type VT_UI1, dimension one, and have an element count equal to the number of bytes of post data.
Applies To
WebBrowser, Internet Explorer
See also DWebBrowserEvents2::BeforeNavigate2, DWebBrowserEvents2::NavigateComplete2
HRESULT Navigate2(
[in] VARIANT * URL,
[in, optional] VARIANT * Flags,
[in, optional] VARIANT * TargetFrameName,
[in, optional] VARIANT * PostData,
[in, optional] VARIANT * Headers,
);
Navigates the browser to a location that may not be able to be expressed as a URL, such as a pointer to an item identifier list (PIDL) for an entity in the Windows shell namespace.
| S_OK | The operation was successful. |
| E_INVALIDARG | One or more parameters are invalid. |
| E_OUTOFMEMORY | Out of memory. |
This method extends the Navigate method to allow for shell integration; however, the original Navigate method can still be used for URL navigations (Navigate2 does not make Navigate obsolete).
The post data specified by PostData is passed as a SAFEARRAY structure. The variant should be of type VT_ARRAY and point to a SAFEARRAY. The SAFEARRAY should be of element type VT_UI1, dimension one, and have an element count equal to the number of bytes of post data.
Applies To
WebBrowser, Internet Explorer
See also DWebBrowserEvents2::BeforeNavigate2, DWebBrowserEvents2::NavigateComplete2
HRESULT PutProperty(
BSTR szProperty,
VARIANT vtValue
);
Sets the value of a property associated with the given object.
| S_OK | The operation was successful. |
| E_INVALIDARG | One or more parameters are invalid. |
| E_OUTOFMEMORY | Out of memory. |
Applies To
Internet Explorer
See also IWebBrowser2::GetProperty
HRESULT QueryStatusWB(
[in] OLECMDID nCmdID,
[out, retval] OLECMDF *pcmdf
);
Implements a wrapper that allows you to query an OLE object for status of commands using the IOleCommandTarget::QueryStatus method.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::ExecWB
HRESULT Quit(void);
Closes the Internet Explorer application.
Applies To
Internet Explorer
HRESULT Refresh(void);
Reloads the file that Internet Explorer is currently displaying.
Applies To
WebBrowser, Internet Explorer
HRESULT Refresh2(
VARIANT FAR* Level
);
Reloads the file that Internet Explorer is currently displaying. Unlike IWebBrowser2::Refresh, this method contains a parameter that specifies the refresh level.
Applies To
WebBrowser, Internet Explorer
HRESULT ShowBrowserBar(
VARIANT FAR* pvaClsid,
VARIANT FAR* pvarShow,
VARIANT FAR* pvarSize
);
Shows or hides a specified browser bar.
Applies To
Internet Explorer
HRESULT Stop(void);
Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.
Applies To
WebBrowser, Internet Explorer
See also DWebBrowserEvents2::BeforeNavigate2, DWebBrowserEvents2::DownloadBegin, DWebBrowserEvents2::ProgressChange, IWebBrowser2::Quit, IWebBrowser2::Refresh
HRESULT get_AddressBar(
VARIANT_BOOL FAR* pValue
);
Determines if the Internet Explorer object's address bar is visible.
Applies To
Internet Explorer
See also IWebBrowser2::put_AddressBar
HRESULT get_Application(
IDispatch * FAR* ppDisp
);
Retrieves the automation interface supported by the Internet Explorer application.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::get_Container, IWebBrowser2::get_Document, IWebBrowser2::get_Parent
HRESULT get_Busy(
VARIANT_BOOL FAR* pBool
);
Discovers whether Internet Explorer is engaged in a downloading operation or other activity.
Applies To
WebBrowser, Internet Explorer
HRESULT get_Container(
IDispatch * FAR* ppDisp
);
Retrieves a pointer to the IDispatch interface of the container.
| S_OK | The operation was successful. |
| E_FAIL | The operation failed. |
| E_NOINTERFACE | The interface is not supported. |
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::get_Application, IWebBrowser2::get_Document, IWebBrowser2::get_Parent
HRESULT get_Document(
IDispatch * FAR* ppDisp
);
Retrieves a pointer to the IDispatch interface of the Active Document object.
| S_OK | The operation was successful. |
| E_FAIL | The operation failed. |
| E_INVALIDARG | One or more parameters are invalid. |
| E_NOINTERFACE | The interface is not supported. |
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::get_Application, IWebBrowser2::get_Container, IWebBrowser2::get_Parent
HRESULT get_FullName(
BSTR FAR* pbstrFullName
);
Retrieves the fully qualified path of the Internet Explorer executable file.
| S_OK | The operation was successful. |
| E_FAIL | The operation failed. |
| E_OUTOFMEMORY | Out of memory. |
Applies To
WebBrowser, Internet Explorer
HRESULT get_FullScreen(
VARIANT_BOOL FAR* pbFullScreen
);
Determines if Internet Explorer is in full-screen or normal window mode.
In full-screen mode, the Internet Explorer main window is maximized and the status bar, toolbar, menu bar, and title bar are hidden.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::put_FullScreen
HRESULT get_Height(
long FAR* pl
);
Retrieves the height of the Internet Explorer main window.
Applies To
WebBrowser, Internet Explorer
See also IWebBrowser2::get_Width, IWebBrowser2::put_Height
HRESULT get_HWND(
long FAR* pHWND
);
Retrieves the handle to the Internet Explorer main window.
Applies To
Internet Explorer
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.