Visual Basic Concepts

Advanced Customization for Internet Component Download

There are several things you can do to customize your file download, including:

  • Modifying an .inf file for the project. You might do this if you want to include information about your security settings, or to include an outside review of your component.

  • Modifying the .ddf file for the project. You need to do this if you have added any additional files to your download, or if you have changed your .inf file.

  • Manually rebuilding the . You need to do this if you have modified your .inf or .ddf files in any way.

The following sections provide more information on making these changes.

Modifying the .inf File

You can customize the installation process by modifying the .inf file. The modified file can then be included in a manually rebuilt .cab file (using the .ddf project file), or it can be directly referenced by the CODEBASE attribute of the OBJECT tag.

Note   An .inf file can be used in the CODEBASE attribute, but this should be avoided. Since an .inf file cannot have a , using it here would require you to digitally sign any compiled files (for example, .ocx files) to which it refers. This may require you to sign and deploy several executables individually, rather than signing one .cab file that packages all of them.

Typical modifications to an .inf file include:

  • Adding a license agreement.

  • Adding a readme file.

  • Adding additional documentation.

Note   As an ActiveX control developer, you can modify your Internet component download files, but you should be aware that doing so may place a potential liability on yourself or your firm if the modifications are done incorrectly. Some changes indicate that you guarantee, assure, or warranty that the changes are correct and truthful. Attempts to avoid these liabilities by citing "as is" or "suitability" clauses in a license agreement may be ruled invalid by many courts.

Sample .inf File

Here is an example of an .inf file:

;inf file for ControlDemo.ocx
;DestDir can be 10 for Windows directory, 11 for Windows\System(32) directory, or left blank for the Occache or the Downloaded Program Files directory.

[version]
signature=$CHICAGO$

[Add.Code]
CONTROLDEMO.OCX=CONTROLDEMO.OCX
MSVBVM60.DLL=MSVBVM60.DLL

[CONTROLDEMO.OCX]
file-win32-x86=thiscab
RegisterServer=yes
clsid={F651BF93-239B-11D0-8908-00A0C90395F4}
DestDir=
FileVersion=1,0,0,1

[MSVBVM60.DLL]
hook=MSVBVM60.cab_Installer
FileVersion=5,1,43,19

[MSVBVM60.cab_Installer]
file-win32-x86=http://activex.microsoft.com/controls/vb6/MSVBVM60.cab
InfFile=MSVBVM60.inf

Important   Only the original developer may legally mark a control as safe. There are no circumstances where you should ever mark someone else's control as safe. Changing the safety of a control can result in both a copyright infringement and criminal charges.

Adding Version Information to the .inf File

You can use the .inf file to specify the version of your component. The .inf file should have a file section that specifies a version and the same class ID specified in the <OBJECT> tag.

As illustrated in the example below, this file version specifies the version of the ActiveX control to be downloaded:

[circ3.ocx]
; The lines below specify that the specified Circ3.ocx (clsid,
; version) needs to be installed on the system. If it doesn't exist
; already, can be downloaded from the given location (a .cab).
NOTE:
; If "thiscab" is specified instead of the file location, it is
; assumed that the desired file is present in the same .cab cabinet
; that the .inf originated from. If the location pointed to
; is a different .cab, that cabinet is also downloaded and
; unpacked in order to extract the desired file.

file=http://www.mycompany-inc-10.com/circ3/circ3.cab
clsid={9DBAFCCF-592F-101B-85CE-00608CEC297B}

; Note that the {}s are required when entering the CLSID in the .inf
; file. This is slightly different from the HTML syntax for inserting
; CLSIDs in an <OBJECT> tag.

FileVersion=1,0,0,143

Modifying the .ddf File

You need to modify the project's .ddf file if you modify the .inf file or digitally sign your control in the Support directory. You also need to verify that any files added to the .inf file have also been added to the .ddf file, or they will not be available for installation.

Here is an example of a .ddf file created by the Package and Deployment Wizard:

.OPTION EXPLICIT
.Set Cabinet=on
.Set Compress=on
.Set MaxDiskSize=CDROM
.Set ReservePerCabinetSize=6144
.Set DiskDirectoryTemplate=
.Set CompressionType=MSZIP
.Set CompressionLevel=7
.Set CompressionMemory=21
.Set CabinetNameTemplate="ControlDemo.cab"
"C:\Website\Cabfiles\ControlDemo.inf"
"C:\ControlDemo\ControlDemo.ocx"

The following entries in the .ddf file should not be changed:

Entry Description
MaxDiskSize=CDROM This allows the .cab file to be as large as needed.
ReservePerCabinetSize=6144 This reserves space for a digital signature.

Manually Building .cab Files

You need to rebuild the .cab file every time you modify the .inf or .ddf file associated with it. To rebuild the .cab file, you need Microsoft's Cabinet Builder, Makecab.exe. This file is usually located in \VB\Setupkit\kitfil32.

The simplest way to rebuild the .cab file is to use the existing .ddf file for the project with the following command:

makecab /f yourcontrolname.ddf

The Cabinet Builder generates two additional informational files, setup.inf and setup.rpt.

For More Information   For more information on modifying files associated with a .cab file, see to the Microsoft Developer's Network. For detailed information about .inf files, see the documentation included with Microsoft's Visual C++ and on the MSDN Library CD-ROM.