The InternetExplorer object allows you to work with an Internet Explorer application.
Use the new keyword to create a new instance of Internet Explorer.
{Create a new instance of Internet Explorer.} IExplorer = new SHDocVw.InternetExplorer();
When using Distributed COM (DCOM), create a new instance of Internet Explorer with the COM_CreateObject() function. In the following example, an instance of Internet Explorer is created on the computer “SystemServer”.
{Create a new instance of Internet Explorer.} IExplorer = COM_CreateObject("SHDocVw.InternetExplorer", "SystemServer");
The Visible property allows you to show or hide the application. Setting the Visible property to true shows the application.
{Show the application.} IExplorer.Visible = true;
Setting the Visible property to false hides the application.
{Hide the application.} IExplorer.Visible = false;
The new keyword and the COM_CreateObject function return a hidden instance of an application. Use the Visible property to show a hidden application. |
Use the Navigate method to load a web page in Internet Explorer. You can load a web page with the Navigate method by specifying the URL.
{Use a URL to load a web page.} IExplorer.Navigate("msdn.microsoft.com");
You can also load a file with the Navigate method by specifying the full pathname of the file.
{Use the full pathname to load a local file.} IExplorer.Navigate("C:\RESM\RESM.XML");
To refresh a web page, call the Refresh method.
{Refresh the web page.} IExplorer.Refresh();
To stop a web page from loading, use the Stop method.
{Stop loading a web page.} IExplorer.Stop();
The Silent property allows you to hide and show dialog boxes in Internet Explorer. Setting the Silent property to true hides the dialog boxes.
{Hide the dialog boxes.} IExplorer.Silent = true;
Setting the Silent property to false shows the dialog boxes. This is the default setting.
{Show the dialog boxes.} IExplorer.Silent = false;
Hiding dialog boxes prevents the user from seeing warning messages and other prompts displayed by an application. Your code still must handle the errors or other exceptional conditions that caused Internet Explorer to display dialog boxes. |
After you have finished using the application, you can close it with the Quit method.
{Close the application.} IExplorer.Quit();