EnhCab.AddFile

[This is preliminary documentation and subject to change.]

The AddFile method adds a file to a cabinet file.

Syntax

object.AddFile( sFile, sCabFileName )
 

Parts

object
Object expression that resolves to an EnhCab object.
sFile
String that specifies the path and filename of the file to add to the cabinet file.
sCabFileName
String that specifies name of the file as it appears in the cabinet file. This will be the name of the file when it is unpacked from the cabinet file.

Remarks

When you are adding files to a cabinet file, your application should ensure that the total size of files added does not exceed the value of lMediaSize specified when the cabinet was created. If your application needs to add additional files after the size limit is reached, it must create a new cabinet to hold the extra files.

The EnhCab object does not support linked cabinet files. In other words, you cannot store part of a file or folder in one cabinet and the rest in another cabinet.

QuickInfo

  Windows NT: Unsupported.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in ipenhsnd.idl.
  Import Library: Included as a resource in ipenhsnd.dll.
  Unicode: Yes.

See Also

EnhCab.NewCabinet, EnhCab.CloseCabinet

Examples

The following example creates a new cabinet file, Cab1.cab, and stores two files in it.

'Create an instance of an EnhCab object
'and store it in the ecab variable
Dim ecab As EnhCab
Set ecab = New EnhCab
 
'Create the cabinet file
ecab.NewCabinet "Cab1.cab", 2000000, 2000000, 1
 
'Add files to the cabinet file
ecab.AddFile "C:\File1.htm", "File1.htm"
ecab.AddFile "C:\File2.htm", "File1.htm"
 
'Close the cabinet file and write it to disk
ecab.CloseCabinet