Microsoft KB Archive/199697

= How To Obtain and Use the SetCodeBase Utility with Visual Basic ActiveX Documents =

Article ID: 199697

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer (Programming) 5.01 SP1
 * Microsoft Internet Explorer 5.5
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5

-



This article was previously published under Q199697



SUMMARY
This article describes how to obtain and use the SetCodeBase utility. SetCodeBase embeds CodeBase and version information inside your .vbd file directly without using an HTML file.

NOTE: SetCodeBase does not work with Internet Explorer 3.02 or earlier; it is designed for use in Internet Explorer 4.0 and later.



MORE INFORMATION
In Visual Basic 5.0, when you use the Setup Wizard to create an Internet Package for a UserDocument project, the wizard creates an .htm and a .cab file. You have to place these files on your server, along with the .vbd file. By default, users must open the .htm file to download and launch your UserDocument. The .htm file contains the CodeBase (your .cab file) and version information, as well as instructions to launch the UserDocuments. However, if you use the SetCodeBase tool, you do not have to use the HTML file and can open the .vbd file directly.

In Visual Basic 6.0, when you use the Package and Deployment Wizard to create an Internet Package for a UserDocument project, the CodeBase and version information is included in the UserDocuments. Thus, users can open the .vbd files directly without using an HTML file. Developers should use the SetCodeBase tool to verify and alter the CodeBase and version information for the UserDocuments.

How to Obtain SetCodeBase
 The SetCodeBase utility does not ship with Visual Basic 5.0 or 6.0. You can download SetCodeBase from the following Microsoft Web site:

http://msdn.microsoft.com/vbasic/downloads/download.asp?ID=038

NOTE: To access this download, you must register your version of Visual Basic. Have your Product ID available. For more information, see the following Microsoft Web site:

http://msdn.microsoft.com/vbasic/register/vb6.asp

 Use a decompression utility such as WinZip to decompress the .zip file.

How to Add and Display the CodeBase and Version Information
After you package the UserDocument project, you can use the SetCodeBase tool to add or change the CodeBase and version information as follows:
 * 1) Double-click VbCodeBase.exe to start the tool.
 * 2) In the VBD file name box, type the path to your .vbd file. or click the ellipses (...) button to browse to the file.
 * 3) If the .vbd file already includes the CodeBase and version information, the tool displays this information.

If the .vbd file does not include the CodeBase and version information, either you can click Scan HTM and browse to the HTML page that the wizard created (which populates the information for you), or you can type the information as follows:
 * 1) * Codebase URL is the URL path and .cab file name that is created for the UserDocument. Most likely, you will type a relative path, although you can also type the absolute path.
 * 2) * CLSID is the Class ID of the component that is associated with your UserDocuments. This property is read-only; you cannot alter this value manually.
 * 3) * Version is the UserDocument version. If the version information is not already added for you, you can locate the version information from the project properties in your Visual Basic project.
 * 4) After you verify that all of the information is correct, click Set to save the changes.

Additional Notes

 * Only Internet Explorer 4.0 or later uses the information that is added to the .vbd file. However, the .vbd file still works in Internet Explorer 3.02 when it is used in conjunction with the .htm file.
 * Double-clicking the .vbd file from Windows Explorer does not work.
 * You can use SetCodeBase to view a CLSID that is embedded in your .vbd file, which can help you debug some download problems.
 * There is also a command prompt version of the SetCodeBase utility in the same SetCodeBase.zip file. For more information, see the ReadMe.txt that is included with the .zip file.

