2005年07月07日

use CreateObject to access to COM,so to obtain some functions that are not provided in VBscript or Jscript

if COM Objects start with the same name, they are in the same physical file.All the Scripting Objects live inside SCRRUN.DLL, and all the WScript Objects
are stored inside WSHOM.OCX. You can view both files in the Windows system
folder.

Any object name you supply to CreateObject—like Scripting.
FileSystemObject or WScript.Shell—is really a ProgID, or program
identifier. You will always find a Registry key in HKEY_CLASSES_ROOT\ with
the same name. This is the central store telling CreateObject how to
access the object. If the Registry key is missing, you will no longer be able
to access the object.

It has two subkey:CLSID and CurVer. CLSID shows the classID.The compiler that produced the run-time object generates the Class-ID.you can’t manually
change the Class-ID by changing Registry values. If you did, you could no
longer access the object because the Registry Class-ID needs to match the
Class-ID stored inside the object. The same is true if you update an object file.
Because the new version has a new Class-ID, you need to register the new
object. Just replacing the file would disable the object.

go to HKEY_CLASSES_ROOT\CLSID\ to find detailed object information

1, Fill the Directory Table

Directory Directory_Parent DefaultDir
TARGETDIR   SourceDir
EXEDIR TARGETDIR App
DLLDIR EXEDIR Bin
DesktopFolder TARGETDIR Desktop

if EXEDIR is defined with full path, App will be installed to EXEDIR, or else, it will be installed to TARGETDIR/App

2, Fill the Component table

Component ComponentId Directory_ Attributes Condition Keypath
Baseball {F54ABAC0-33F2-11D3-91D7-00C04FD70856} SPORTDIR 2 Baseball.txt
Concert {76FA7A80-33F6-11D3-91D8-00C04FD70856} ARTSDIR 2 Concert.txt

Component ID should be different each time and Directory is defined in directory table

3, Fill the File Table

File Component_ FileName FileSize Version Language Attributes Sequence
Baseball.txt Baseball Baseball.txt 1000 0 1
Concert.txt Concert Concert.txt 1000 0 1

4, Fill the media Table

DiskId LastSequence DiskPrompt Cabinet VolumeLabel Source
1 1

LastSequence:File sequence number for the last file for this media

5, Feature Table

Feature Feature_Parent Title Description Display Level Directory_ Attributes
Arts Arts Arts events at Red Park. 20 3 NOTEPADDIR 0
Baseball Sport Baseball Baseball Games 17 3 SPORTDIR 32
Display
The number in this field specifies the order in which the feature is to be displayed in the user interface. The value also determines if the feature is initially displayed expanded or collapsed.

If the value is null or zero, the record is not displayed. If the value is odd, the feature node is expanded initially. If the value is even, the feature node is collapsed initially.

Level
The initial installation level of this feature. Processing the Condition Table can modify the level value. For more details, see Install Level in the Remarks section.

An install level of zero disables the item and prevents it from being displayed.

6, Component and Feature relationship

7, Regitry table