The Internet Explorer Object Model
The Internet Explorer version 3.0 object model is flat—that is, it has only one level. In this respect it is unlike many other object models. The single-level architecture of the Internet Explorer model makes it significantly easier to master than many other applications. Figure 3-4 shows the complete Internet Explorer object model, and Tables 3-1 and 3-2 describe the object's properties and methods.
Figure 3-4.
The Internet Explorer object model.
Table 3-1.Properties of the Microsoft Internet Explorer, Version 3.0
Property | Type | Description | Usage |
Application | Object | Returns a reference to the Internet Explorer object. | Set MyObject = browser.Application |
Busy | Boolean | Returns a boolean value indicating whether the Internet Explorer is busy downloading data or performing some other activity. True indicates busy; False indicates not busy. | If browser.Busy Then…EndIf |
Container | Object | Returns a reference to the container/parent of the Internet Explorer, if any exists. | Set MyObject = browser.Container |
Document | Object | Returns a reference to the active document, if any exists. | Set MyDocument = browser.Document |
FullName | String | Returns the full pathname to the Internet Explorer executable. (Example: C:\PROGRAM FILES\Plus!\MICROSOFT INTERNET\IEXPLORE.EXE) | MsgBox browser.FullName |
FullScreen | Boolean | Returns or sets the Internet Explorer window mode. True indicates that the window is maximized and that the status bar, toolbar, menu bar, andtitle bar are hidden. | If browser.FullNameThen…EndIf browser.FullScreen = True |
Height, Width | Long | Returns or sets the dimensions in pixels of the Internet Explorer window. | MsgBox browser.Height browser.Height = 400 |
HWND | Long | Returns the window handle MsgBox of the current Internet Explorer window. | browser.HWND |
Left, Top | Long | Returns or sets the position in pixels of the Internet Explorer window relative to the screen/container. | MsgBox browser.Left browser.Left = 100 |
LocationName | String | Returns the name of the file currently being viewed. (Example: Microsoft Corporation) | MsgBox browser.LocationName |
LocationURL | String | Returns the full URL for the file currently being viewed. (Example: https://www.microsoft.com/) | MsgBox browser.LocationURL |
MenuBar | Boolean | Returns or sets the display of If the menu bar. True indicates that the menu bar is visible; False indicates that it is hidden. | browser.MenuBar Then…EndIf browser.MenuBar = True |
Name | String | Returns the name of the Internet Explorer application. (Example: Microsoft Internet Explorer) | MsgBox browser.Name |
Parent | Object | Returns a reference to the container/parent of the Internet Explorer. | Set MyObject = browser.Parent |
Path | String | Returns the full pathname to the Internet Explorer application. (Example: C:\PROGRAM FILES\PLUS!\MICROSOFT INTERNET\) | MsgBox browser.Path |
StatusBar | Boolean | Returns or sets the display of the status bar. True indicates that the status bar is visible; False indicates that it is hidden. | If browser.StatusBar Then…EndIf browser.StatusBar = True |
StatusText | String | Returns or sets the text for the status bar. | MyString = browser.StatusText browser.StatusText = MyString |
ToolBar | Long | Returns or sets which toolbar is shown. For example, 0 indicates no toolbar; 1 indicates the default toolbar. | MsgBox browser.toolbar browser.toolbar = 1 |
TopLevelContainer | Boolean | Returns a Boolean value indicating whether the current object is the top-level container. True indicates that the object is the top-level container; False indicates that it is not. | If browser. TopLevelContainer Then…EndIf |
Type | String | Returns the type of document in the Internet Explorer. | MyType = browser.Type |
Visible | Boolean | Returns or sets the display of the Internet Explorer. True indicates that the Internet Explorer is visible; False indicates that it is hidden. | If browser.Visible Then…EndIf browser.Visible = True |
Table 3-2.Methods of the
Microsoft Internet Explorer, Version 3.0
Method | Description | Usage |
ClientToWindow(pcx, pcy) | Converts client sizes into window sizes. pcx and pcy are defined as long. | |
GetProperty
(szProperty) |
Returns the value for the specified property. szProperty is defined as a string. | |
GoBack, GoForward | Used to navigate the Internet Explorer, based on values in the history list. | browser.GoBack |
GoHome, GoSearch | Used to navigate the Internet Explorer. | browser.GoHome |
Navigate (URL [, Flags] [, TargetFrameName] [, PostData] [, Headers]) | Jumps to the specified URL. is one of the following constants or values: navOpenInNewWindow=1 navNoHistory=2 navNoReadFromCache=4 navNoWriteToCache=8 TargetFrameName is a string that specifies the name of the frame in which results will be displayed. PostData is the data to send with the HTTP post transaction. Headers is a value that specifies the HTTP headers to send. | Flagsbrowser.Navigate ("http://www.vb-bootcamp.com") |
PutProperty(szProperty, vtValue | Sets the property to the specified vtValue) value. szProperty is defined as a string and is defined as a variant. | |
Quit | Exits the Internet Explorer application and closes the open document. | browser.Quit |
Refresh | Refreshes the current document. | browser.Refresh |
Refresh2 [Level] | Refreshes the current document. Level is one of the following constants or values: REFRESH_NORMAL=0 REFRESH_IFEXPIRED=1 REFRESH_CONTINUE=2 REFRESH_COMPLETELY=3 | browser.Refresh2(0) browser. Refresh2(REFRESH_NORMAL) |
Stop | Stops loading the current document. | browser.Stop |