Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Download a Text File Using Internet Explorer Component Download

View products that this article applies to.


A text file can be downloaded in connection with an ActiveX control or by itself using the Microsoft Internet Explorer component download facility.

↑ Back to the top

More information

Downloading a text file using the component download facility requires a unique Class ID (GUID) that can be a Class ID associated with a dummy ActiveX control or a dummy GUID generated specifically for the purpose of downloading a text file by itself.

Downloading a text file in association with a dummy ActiveX control (a control whose only purpose is to provide a versioning mechanism for downloading a text file) follows the same principles as downloading a Readme.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 than either a Visual Basic (VB) or an MFC-based ActiveX control.

To create the files necessary for downloading a text file with an ActiveX control 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 the bottom of the list of entries:
       ... (other files)
    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:
    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 ActiveX Control, the text file is downloaded each time the page is refreshed since there is no version information to control the download process.

To create the files necessary for downloading a text file each time page is refreshed:
  1. Create an .inf file (Mytext.inf) similar to the following:
       ; INF file for text file download
    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:
       <TITLE>Text file download sample</title>
       Before text cab object-->
       <OBJECT ID="MyText" width=0 height=0
       <--after text cab object
Note that the CLSID in the sample above is shown for discussion purposes only. Your CLSID for the <OBJECT> tag would be defined in step 4. DO NOT use the GUID above in production code to avoid conflict with a similar dummy GUID used by another developer.

Each time an HTML page like the one shown above is accessed, the text file in will be downloaded into the Windows directory.

↑ Back to the top


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:

↑ Back to the top


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.

↑ Back to the top

Keywords: KB185373, kbhowto

↑ Back to the top

Article Info
Article ID : 185373
Revision : 3
Created on : 5/11/2006
Published on : 5/11/2006
Exists online : False
Views : 387