Solved

VB Interacting with Internet Explorer

Posted on 1998-11-24
3
599 Views
Last Modified: 2012-05-04
I am hoping someone can help me with three questions that I have about interaction with Internet explorer.

The first is: How do you clear the cache (the equivalent of right clicking on the explorer icon and selecting properties and then selecting the delete button under Temporary Internet Files)?

The second is: How do I submit a URL to a the browser and then after a specified time send another URL to the same browser (not opening another browser)?

The last Question is: How can you tell when Internet explorer is done loading a page from a VB application? I would like to submit a URL and check if the it has finished loading and then submit another.
0
Comment
Question by:cliff_martin
3 Comments
 

Expert Comment

by:Languard
ID: 1446500
Answer to the second question

Refrence the Microsoft Internet Controls
Add the following code:
Dim Browser As InternetExplorer
'Create the object
Set Browser = CreateObject("InterNetExplorer.Application")
Browser.Visible = True
'Open the web page
Browser.Navigate ("http://URL")
'Wait until the page is done loading
Do While Browser.Busy
    DoEvents
Loop

Browser.Navigate ("ftp://URL")
0
 

Author Comment

by:cliff_martin
ID: 1446501
I would like to give the points to languard, however he only answered one of the questions. The Question that I am having the most difficulty with is the cache question.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1446502
Here is how to communicate using DDE
Dynamic Data Exchange Support in Microsoft Internet Explorer
Last reviewed: October 3, 1997
Article ID: Q160957  
The information in this article applies to:
Microsoft Internet Explorer versions 3.0, 3.01 for Windows 95
Microsoft Internet Explorer versions 3.0, 3.01 for Windows NT 4.0
Microsoft Internet Explorer version 3.x for Windows 3.1
Microsoft Internet Explorer version 3.x for Windows NT 3.51


SUMMARY
Several years ago, Spyglass, Inc. defined a Software Development Interface (SDI) that has served as the basis for most common interprocess communication (IPC) support in current browsers.

The SDI is composed of a number of generic, platform-independent verbs that are implemented through platform-specific transports. For Internet Explorer (IE) running in the Microsoft Windows environment, that platform-specific transport is DDE.

The 16-bit versions of Internet Explorer for Windows 3.1 and Windows NT 3.51 very closely followed this Spyglass specification. Versions 2.x and 3.x of the 16-bit Internet Explorer supported the entire list of topics as well as parameters outlined in the spec. If your application specifically targets the 16-bit version of Internet Explorer, please refer to the Spyglass SDI specs above for more information on its DDE support.

On the other hand, the 32-bit versions of Internet Explorer, supported only a subset of the topics described in the Spyglass SDI specification. This article specifically lists this subset of topics supported by the 32-bit IE versions, as well as relevant DDE-specific information for each of these topics.



MORE INFORMATION
Most of the information below applies to the 32-bit versions of Internet Explorer, unless specifically indicated.

In each of the DDE transactions described below, you need to specify the following:


   ApplicationName : iexplore
   DDE Transaction Type: XTYP_EXECUTE or XTYP_REQUEST

Topic and item names and expected return values for each verb are described below. Note that Internet Explorer version 2.0 and earlier used "mosaic" as its service name, instead of "iexplore."
Note that all strings passed to DDEML using DdeCreateStringHandle are limited to 255 characters. When passing item names to any of the topics described below, strings greater than 255 characters long are truncated.

For more information about this 255-character limit in DDEML, please see the following article in the Microsoft Knowledge Base:


   ARTICLE-ID: Q102570
   TITLE     : DOCERR: DdeCreateStringHandle() lpszString param

OpenURL
OpenURL retrieves a URL off the Web and displays it, based on specified WindowID:


   topicName: WWW_OpenURL
   itemName : URL  <Example: "http://www.microsoft.com">
   returnValue: -2 for acknowledgment, -3 for error

In the 32-bit versions of Internet Explorer, all other parameters specified in the SDI spec are ignored.
Note that when specifying the URL for the 16-bit version of IE, be sure to specify the full URL, including the protocol, for example, "http://www.microsoft.com" instead of "www.microsoft.com"; otherwise, the OpenUrl call will fail.

For IE4, itemName can be specified as follows:


   itemName: URL,[FileSpec],WindowID  <Example:
   "http://www.microsoft.com",,0>

Note that the second parameter, FileSpec, specified in the SDI spec, is ignored, and is, therefore, not specified in the itemName example above. All other parameters following the WindowID parameter that are not specified above are similarly ignored.
Specifying a WindowID of 0 tells the browser to open a new window; whereas -1 opens the URL in the most recently active browser window.



ShowFile
ShowFile passes FileSpec to be rendered in a given WindowID:


   topicName: WWW_ShowFile
   itemName: FileSpec
   returnValue: -2 for acknowledgment, -3 for error

All other parameters are ignored.


ActivateWindow
Regardless of the WindowId specified, ActivateWindow brings the most recently active browser window to the foreground:


   topicName: WWW_Activate
   itemName:  WindowID <any value>
   returnValue: WindowID

All other parameters are ignored.
Note that the WindowID returned is synthetic; that is, it can only be used in other DDE transactions with IE. It should not be assumed as an HWND.



Exit
Exit tells the browser to shut down and exit:


   topicName: WWW_Exit
   itemName: WWW_Exit
   returnValue: 0

RegisterURLEcho
RegisterURLEcho requests that ApplicationName be notified of URLEcho events whenever a URL gets loaded. Multiple servers can be registered to get these notifications:


   topicName: WWW_RegisterURLEcho
   itemName: ApplicationName (enclosed in double quotes)
   returnValue: Non-Zero for success, 0 for failure

ApplicationName is a DDE server that is registered to receive WWW_URLEcho notifications from the browser with the following information:

   topicName (hsz1): WWW_URLEcho
   itemName  (hsz2): URL,MIMEType,WindowID
   <Example: "http://www.home.com","text/html",-1>
   Transaction: XTYP_POKE

NOTE: WWW_RegisterURLEcho and WWW_UnRegisterURLEcho are new to IE 3.01. An application using IE 3.0 may need to upgrade to IE 3.01 to take advantage of this functionality.


UnRegisterURLEcho
UnRegisterURLEcho terminates associated request for URLEcho events notification:


   topicName: WWW_UnRegisterURLEcho
   itemName:  ApplicationName (enclosed in double quotes)
   returnValue: 0

IE4 returns success/failure on this (instead of ALWAYS 0).


RegisterProtocol
RegisterProtocol registers the DDE Server application, Server.exe, to handle URLs of a specific Protocol type:


   topic Name: WWW_RegisterProtocol
   item Name:  AppName,Protocol <Example:"AppName","mailto">

Where "AppName" is Server.exe's registered Service Name, and "mailto" is the protocol to be registered.
Note that each of the strings have to be explicitly enclosed in double quotes. For Example, in C, the same string will have to be specified as:


   "\"AppName\",\"mailto\""
   returnValue: Non-Zero for success, 0 for failure

Server.exe will then get notifications from the browser with the following information:

   topic Name (hsz1): WWW_OpenURL
   item Name  (hsz2): URL,[FileSpec],WindowID,Flags
   <Example:"mailto:billg@ms.com",,-1,0>
   Transaction: XTYP_REQUEST

Note that Flags is currently undefined and is always set to 0.
In order to convert hsz1 and hsz2 into strings, the function DdeQueryString needs to be called.

Note that, as indicated in the specification, a protocol can be registered to only one DDE server application at a time. In this case, only the application Server.exe will get notifications from the browser whenever the user clicks on any "mailto:" reference on a Web page.



UnRegisterProtocol
UnRegisterProtocol terminates associated request for protocol notification:


   topicName: WWW_UnRegisterProtocol
   itemName:  ApplicationName (enclosed in double quotes)
   returnValue: 0

ListWindows
Returns a list of window IDs for windows currently used by the browser:


   topicName: WWW_ListWindows
   itemName:  WWW_ListWindows
   returns: NumItemsInTheList,ArrayOfWindowIDs
   (ie [count,winID,winID,winID])

Currently Internet Explorer always returns 1,-1 indicating there's only one window open, which may or may not necessarily be true.


GetWindowInfo
Returns URL and WindowText currently being displayed in the browser window:


   topicName: WWW_GetWindowInfo
   itemName:  WWW_GetWindowInfo
   returnValue: URL,WindowText
   <Example: "http://www.microsoft.com/","Microsoft Home Page">

Note that the strings are quoted; therefore, double quotes are denoted with backslashes. For example, if the title consists of the three characters !"!, the title portion of the returned string as the six characters "!\"!".
For additional information, please see the following article in the Microsoft Knowledge Base:


   ARTICLE-ID: Q160976
   TITLE     : How to Control the Currently Running Instance of IE3 via DDE
Keywords          : msiexplore kbusage
Technology        : kbole
Version           : 2.0 2.01 2.1 3.0 3.01
Platform          : NT WINDOWS
 

0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 54
SQL VB connection works in one PC and doesn't in another 15 64
VBA: Select SQL query based on a config Sheet v2 11 44
how to know if my Checkbox is True in VB6.0? 9 55
Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question