ToolBar Property
Reference for Visual Basic Developers

ToolBar Property

Description

Returns or sets a value that determines whether the toolbar is visible.

Syntax

object.ToolBar [= value]

PartDescription
object Required. An object expression that evaluates to an InternetExplorer object.
value Optional. A Boolean expression that determines whether the toolbar is visible. If TRUE, the toolbar is visible; if FALSE, it is hidden. The default is TRUE.

Remarks

The WebBrowser object ignores the ToolBar property.

Applies To

InternetExplorer, WebBrowser

See Also

StatusBar, Visible


Top Property

Description

Returns or sets the distance between the internal top edge of the WebBrowser control and the top edge of its container.

Syntax

object.Top [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A long integer expression that specifies the distance.

Remarks

The Top property is measured in units depending on the coordinate system of its container. The values for this property change as the object is moved by the user or by code.

Applies To

InternetExplorer, WebBrowser


TopLevelContainer Property

Description

Returns a Boolean value indicating whether the given object is a top-level container.

Syntax

object.TopLevelContainer

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser


Type Property

Description

Returns a string expression that specifies the type name of the contained document object—that is, "Windows HTML Viewer."

Syntax

object.Type

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser


Visible Property

Description

Returns or sets a value indicating whether the object is visible or hidden.

Syntax

object.Visible [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression specifying the visible state of Internet Explorer. If TRUE, the window is visible; if FALSE, it is hidden. The default value is FALSE.

Remarks

Although the Internet Explorer application is hidden when it is first created, it becomes visible after using the Navigate or GoSearch method.

Applies To

InternetExplorer, WebBrowser


Width Property

Description

Returns or sets the horizontal dimension, in pixels, of the frame window that contains the WebBrowser control.

Syntax

object.Width [= width]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
width Optional. A long integer value that specifies the horizontal dimension of the frame window, in pixels.

Applies To

InternetExplorer, WebBrowser

See Also

ClientToWindow, Height


Methods

This section describes the methods associated with the WebBrowser control.


ClientToWindow Method

Description

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.

Syntax

object.ClientToWindow pcx, pcy

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
pcx Required. A long integer value that specifies the x-coordinate of the point in client coordinates. When ClientToWindow returns, this variable contains the x-coordinate of the point in window coordinates.
pcy Required. A long integer value that specifies the y-coordinate of the point in client coordinates. When ClientToWindow returns, this variable contains the y-coordinate of the point in window coordinates.

Applies To

InternetExplorer

See Also

Height, Width


ExecWB Method

Description

Executes a command on an OLE object and returns the status of the command execution using the IOLECommandTarget interface.

Syntax

object.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
nCmdID Required. A long integer that represents the identifier of the command to execute.
nCmdExecOpt Required. A long integer that represents the options set for executing the command.
pvaIn Optional. A variant used for specifying command input arguments.
pvaOut Optional. A variant used for specifying command output arguments.

Applies To

InternetExplorer, WebBrowser


GetProperty Method

Description

Retrieves the current value of a property associated with the given object.

Syntax

object.GetProperty szProperty, vtValue

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
szProperty Required. A string expression that contains the name of the property to retrieve.
vtValue Required. A variable that receives the current value of the property.

Applies To

InternetExplorer

See Also

PropertyChange, PutProperty


GoBack Method

Description

Navigates backward one item in the history list.

Syntax

object.GoBack

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

During a browsing session, the WebBrowser control and Internet Explorer application maintain a history list of all Web sites visited during a session (unless you specify the navNoHistory flag when using the Navigate method). Use the CommandStateChange event to check the enabled state of backward navigation. If the event's CSC_NAVIGATEBACK command is disabled, the beginning of the history list has been reached and the GoBack method should not be used.

Applies To

InternetExplorer, WebBrowser

See Also

GoForward, GoHome, GoSearch, Navigate, CommandStateChange


GoForward Method

Description

Navigates forward one item in the history list.

Syntax

object.GoForward

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

During a browsing session, the WebBrowser control and Internet Explorer application maintain a history list of all Web sites visited during a session (unless you specify the navNoHistory flag when using the Navigate method). Use the CommandStateChange event to check the enabled state of forward navigation. If the event's CSC_NAVIGATEFORWARD command is disabled, the end of the history list has been reached and the GoForward method should not be used.

Applies To

InternetExplorer, WebBrowser

See Also

GoBack, GoHome, GoSearch


GoHome Method

Description

Navigates to the current home or start page, as specified in the Internet Explorer Options dialog box and Internet Control Panel.

Syntax

object.GoHome

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

GoBack, GoForward, GoSearch


GoSearch Method

Description

Navigates to the current search page, as specified in the Internet Explorer Options dialog box and Internet Control Panel.

Syntax

object.GoSearch

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

GoBack, GoForward, GoHome


Navigate Method

Description

Navigates to the resource identified by a Universal Resource Locator (URL) or to the file identified by a full path.

Syntax

object.Navigate URL [Flags,] [TargetFrameName,] [PostData,] [Headers]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
URL Required. A string expression that evaluates to the URL, full path or the Universal Naming Convention (UNC) location and name of the resource to display.
Flags Optional. A constant or value that specifies whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a combination of the following constants or values.
Constant Value Meaning
navOpenInNewWindow 1 Open the resource or file in a new window.
navNoHistory 2 Do not add the resource or file to the history list. The new page replaces the current page in the list.
navNoReadFromCache 4 Do not read from the disk cache for this navigation.
navNoWriteToCache 8 Do not write the results of this navigation to the disk cache.
TargetFrameName Optional. A string expression that evaluates to the name of an HTML frame in URL to display in the browser window. The possible values for this parameter are:
_blank Specifies to load the link into a new unnamed window.
_parent Specifies to load the link into the immediate parent of the document the link is in.
_self Specifies to load the link into the same window the link was clicked in.
_top Specifies to load the link into the full body of the current window.
<window_name> A named HTML frame. If no frame or window exists that matches the specified target name, a new window is opened for the specified link.
PostData Optional. Data to send to the server during the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form to a program or script. If this parameter does not specify any post data, the Navigate method issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP URL.
Headers Optional. A value that specifies additional HTTP headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify things like the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if URL is not an HTTP URL.

Remarks

The WebBrowser control or InternetExplorer object can browse to any location in the local file system, on the network, or on the World Wide Web. Use the Navigate method to tell the browser which location to browse to. By including a text box in your application, you can let the user specify the location to browse to and then pass the location to the Navigate method.

Applies To

InternetExplorer, WebBrowser

See Also

Navigate2


Navigate2 Method

Description

Navigates to the resource identified by a Universal Resource Locator (URL) or to the file identified by a full path. The Navigate2 method extends the Navigate method to support browsing on special folders—such as Desktop and My Computer—that are represented by a pointer to an item identifier list (PIDL). However, this is not applicable to the Visual Basic programming language. For information on this functionality, see the Using the WebBrowser Control from C/C++ section.

Syntax

object.Navigate2 URL [Flags,] [TargetFrameName,] [PostData,] [Headers]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
URL Required. A string expression that evaluates to the URL of the resource to display or the full path to the file location.
Flags Optional. A constant or value that specifies whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a combination of the following constants or values.
Constant Value Meaning
navOpenInNewWindow 1 Open the resource or file in a new window.
navNoHistory 2 Do not add the resource or file to the history list. The new page replaces the current page in the list.
navNoReadFromCache 4 Do not read from the disk cache for this navigation.
navNoWriteToCache 8 Do not write the results of this navigation to the disk cache.
TargetFrameName Optional. A string expression that evaluates to the name of an HTML frame in URL to display in the browser window. The possible values for this parameter are:
"_blank" Specifies to load the link into a new unnamed window.
"_parent" Specifies to load the link into the immediate parent of the document the link is in.
"_self" Specifies to load the link into the same window the link was clicked in.
"_top" Specifies to load the link into the full body of the current window.
<window_name> A named HTML frame. If no frame or window exists that matches the specified target name, a new window is opened for the specified link.
PostData Optional. Data to send to the server during the HTTP POST transaction. For example, the POST transaction is used to send data gathered by an HTML form to a program or script. If this parameter does not specify any post data, the Navigate2 method issues an HTTP GET transaction. This parameter is ignored if URL is not an HTTP URL.
Headers Optional. A value that specifies additional HTTP headers to send to the server. These headers are added to the default Internet Explorer headers. The headers can specify things like the action required of the server, the type of data being passed to the server, or a status code. This parameter is ignored if URL is not an HTTP URL.

Applies To

InternetExplorer, WebBrowser

See Also

Navigate


PutProperty Method

Description

Sets the value of a property associated with the given object.

Syntax

object.PutProperty szProperty, vtValue

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
szProperty Required. A string expression that contains the name of the property to set.
vtValue Required. A variable that specifies the new value of the property.

Applies To

InternetExplorer

See Also

GetProperty, PropertyChange


QueryStatusWB Method

Description

Queries an OLE object and returns the status of commands using the IOLECommandTarget interface.

Syntax

object.QueryStatusWB nCmdID

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
nCmdID Required. A long integer that represents the identifier of the command on which the caller needs status information. This will be one of the OLECMDID values.

Return Value

Returns an unsigned long that is one of the OLECMDF values.

Applies To

InternetExplorer, WebBrowser


Quit Method

Description

Closes the Internet Explorer application.

Syntax

object.Quit

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer

See Also

OnQuit, Stop


Refresh Method

Description

Reloads the page currently displayed in the WebBrowser control.

Syntax

object.Refresh

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The WebBrowser control and Internet Explorer application store Web pages from recently visited sites in cached memory on the user's hard disk. This saves time when revisiting a site by reloading the page from the local disk rather than downloading it again across the network from the remote HTTP server. You can force the WebBrowser control or Internet Explorer application to redownload a page by using the Refresh or Refresh2 method to ensure that you are viewing the most current version of the page. Also, you can disable the cache from being used by specifying the navNoReadFromCache and navNoWriteToCache flags when calling the Navigate or Navigate2 method.

Applies To

InternetExplorer, WebBrowser

See Also

Refresh2, Stop


Refresh2 Method

Description

Reloads the page currently displayed in the WebBrowser control. Unlike the Refresh method, this method contains a parameter that specifies the refresh level.

Syntax

object.Refresh2 [Level]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
Level Optional. A constant or value that specifies the refresh level. It can be one of the following constants or values.
Constant Value Meaning
REFRESH_NORMAL 0 Perform a lightweight refresh that does not include sending the HTTP "pragma:nocache" header to the server.
REFRESH_IFEXPIRED 1 Perform a lightweight refresh if the page has expired.
REFRESH_COMPLETELY 3 Perform a full refresh that includes sending a "pragma:nocache" header to the server (HTTP URLs only).

Remarks

The "pragma:nocache" header tells the server not to return a cached copy. This ensures that the information is as fresh as possible. Browsers typically send this header when the user selects refresh, but the header can cause problems for some servers.

Applies To

InternetExplorer, WebBrowser

See Also

Quit, Refresh, Stop


ShowBrowserBar Method

Description

Shows or hides a specified browser bar.

Syntax

object.ShowBrowserBar pvaClsid, [pvarShow,] [pvarSize]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
pvaClsid Required. A string containing the class identifier of the browser bar to show or hide. This object must be registered as an Explorer Bar object with the CATID_InfoBand component category. For more information, see Band Objects. The standard browser bars use the following class identifiers:

Browser Bar Name    Class ID
Search {30D02401-6A81-11D0-8274-00C04FD5AE38}
Favorites {EFA24E61-B078-11D0-89E4-00C04FC9E26E}
History {EFA24E62-B078-11D0-89E4-00C04FC9E26E}
Channels {EFA24E63-B078-11D0-89E4-00C04FC9E26E}

pvarShow Optional. A Boolean value that specifies whether the browser bar should be shown or hidden. If this is True, the browser bar is shown. If this is False, the browser bar is hidden. The default value is True.
pvarSize Optional. Not currently used.

Remarks

Browser bars, also known as Explorer Bars, can be shown or hidden by the user from Internet Explorer's View menu. The ShowBrowserBar method is ignored by the WebBrowser object.

Applies To

InternetExplorer, WebBrowser


Stop Method

Description

Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.

Syntax

object.Stop

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Before calling the Stop method, you can use the object's Busy property to determine if the browser is currently in the process of navigating to a new location or downloading a file.

Applies To

InternetExplorer, WebBrowser

See Also

BeforeNavigate2, Busy, DownloadBegin, ProgressChange, Refresh, Refresh2

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.