You are currently offline, waiting for your internet to reconnect

How To Download a Text File Using Internet Explorer Component Download

Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
A text file can be downloaded in connection with an ActiveX control or byitself using the Microsoft Internet Explorer component download facility.
More information
Downloading a text file using the component download facility requires aunique Class ID (GUID) that can be a Class ID associated with a dummyActiveX control or a dummy GUID generated specifically for the purpose ofdownloading a text file by itself.

Downloading a text file in association with a dummy ActiveX control (acontrol whose only purpose is to provide a versioning mechanism fordownloading a text file) follows the same principles as downloading aReadme.txt file along with any functional ActiveX control.

When using a dummy ActiveX control, the control would:
  • Have no user interface and the <OBJECT> tag width and height attributes set to zero.
  • Export no methods or properties and accept no initialization parameters.
  • Be built according to requirements for successful Internet component download.
Note that an ATL-based ActiveX control requires less download overhead thaneither a Visual Basic (VB) or an MFC-based ActiveX control.

To create the files necessary for downloading a text file with an ActiveXcontrol are listed in the following steps:
  1. Add entries to the .inf file generated by the VB Setup Wizard or created by hand for ATL and MFC ActiveX controls, or incorporated into the .inf using a third party download setup utility.

    In the [Add.Code] section of the .inf file, include the following at thebottom of the list of entries:
       [Add.Code]   ... (other files)   Myfile.txt=Myfile.txt						
    NOTE: Myfile.txt is the name of the text file you want to download.

    Add the following section to the end of the .inf file:
       [Myfile.txt]   file=thiscab   FileVersion=   DestDir=10   RegisterServer=no						
    The DestDir=10 entry causes the text file to be downloaded to the main Windows directory (Windows 95 and Windows NT). This is necessary so that the file is visible in the file explorer window. Otherwise, if DestDir= is used (no value after the "="), and Internet Explorer 4.0 or later is installed, the text file will not be visible to users in the Downloaded Program Files directory except when viewed in a DOS command window.
  2. Incorporate the .inf file into a cabinet (.cab) file using Makecab.exe (available in the VB/SetupKit/KitFil32 directory), Cabarc.exe (available in the Cabinet (CAB) SDK), or a third party download setup utility.
  3. Sign the CAB file using the code signing tools provided in either the ActiveX SDK or the Internet Client SDK.
  4. Insert an <OBJECT> tag for the ActiveX control into an HTML page in the normal manner. The file Myfile.txt would then be downloaded each time a new version of the ActiveX control was downloaded.
In the alternate scenario, a text file without an associated ActiveXControl, the text file is downloaded each time the page is refreshed sincethere is no version information to control the download process.

To create the files necessary for downloading a text file each time page isrefreshed:
  1. Create an .inf file (Mytext.inf) similar to the following:
       ; INF file for text file download   [Add.Code]   Mytext.txt=Mytext.txt   [Mytext.txt]   file=thiscab   FileVersion=   DestDir=10   RegisterServer=no						
    Myfile.txt is the name of the text file you want to download.
  2. Place the text file and .inf file in a CAB file using Cabarc.exe (available in the Cabinet (CAB) SDK) as follows:
       cabarc n mytext.inf mytext.txt						
    Use the appropriate names that you chose for your .inf and text files, choosing a relevant name for the .cab file.
  3. Sign the CAB file using the code signing tools provided in either the ActiveX SDK or the Internet Client SDK.
  4. Use the Guidgen.exe file to generate a dummy GUID for use in the HTML file <OBJECT> tag. Guidgen.exe is available with Visual Studio 97 in the \DevStudio\VC\Bin folder, or as source code that can be compiled and run.
  5. Create an <OBJECT> tag reference in HTML similar to the one in the following sample:
       <HTML>   <HEAD>   <TITLE>Text file download sample</title>   </HEAD>   <BODY BGCOLOR="#FFFFFF">   Before text cab object-->   <OBJECT ID="MyText" width=0 height=0      CLASSID="CLSID:7DA8B621-FA5A-11d0-B4D7-00AA00B92AB3"      CODEBASE="">   </OBJECT>   <--after text cab object</BODY></HTML>					
Note that the CLSID in the sample above is shown for discussion purposesonly. Your CLSID for the <OBJECT> tag would be defined in step 4. DO NOTuse the GUID above in production code to avoid conflict with a similardummy GUID used by another developer.

Each time an HTML page like the one shown above is accessed, the text filein will be downloaded into the Windows directory.
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

For more information about signing a Visual Basic Internet Application,please see the following article in the Microsoft Knowledge Base:
169609 How To Digitally Sign Your Visual Basic 5.0 Internet Application

For more information, see the following Webcast:

Article ID: 185373 - Last Review: 06/22/2014 18:55:00 - Revision: 5.0

  • kbhowto KB185373