ReadMe for InstallFeature
=========================

In this file:
  - How to add this code to your VB project
  - Additional information
  - Example
  - Disclaimer
  

HOW TO ADD THIS CODE TO YOUR VB PROJECT
---------------------------------------

1. Create a new module, paste the code into it, and save the module.

2. At any place in your code where a certain feature is needed, call the
InstallFeature subroutine before calling the code in the feature.

3. Check the ErrMsg value returned from InstallFeature. If it is not a
zero-length string, then an error occurred and the feature was not
installed. In this case you should display the error message and NOT attempt
to call the feature's code.

4. If no ErrMsg was returned, then the feature was either installed already
or else it was successfully installed. In either case, you are now ready to
call the feature's code.


ADDITIONAL INFORMATION
----------------------

1. Each setup package (MSI database) has a Product Code to identify the
product it contains. The product code is a GUID.

2. Each feature in a setup package is identified by a Feature Name.

3. When you call InstallFeature, you have to supply the ProductCode and
FeatureName. You do not need to supply component codes. To omit them, just
pass a ComponentCount of zero.

4. Your feature's code will need to be in one or more DLL's (or EXE's).
These DLL's can be standard DLL's or they can be COM server DLL's. But in
either case, they will be dynamically linked at run-time. They cannot be
statically linked, because then they would have to be installed before your
application could start.

5. The Declare statement in Visual Basic provides a type of dynamic linking.
Your program can start and run even if one or more of the Declare'd DLL's is
missing. But you must be careful not to call any of the functions in the
missing DLL until you have installed the DLL (by calling InstallFeature).

6. The CreateObject function and the New keyword provide another type of
dynamic linking. The DLL that provides the object does not need to be
installed until you are ready to call CreateObject or New.


EXAMPLE
-------

  Dim ComponentList() As String
  Dim ComponentCount As Long
  Dim ErrMsg As String
  Dim MyObject As Object

' First call InstallFeature to make certain the feature is installed.
' If the COM Server DLL is not installed, this will cause it to be installed
and registered.

  ComponentCount = 0
  If Not InstallFeature(ProductCode, FeatureName, "MyFeature",
ComponentList(), ComponentCount, ErrMsg) Then
    MsgBox ErrMsg
    Exit Sub
  End If

' Now call CreateObject to create a new instance of a class defined in the
COM server supplied by the feature.

  Set MyObject = CreateObject(ProgID)
  MyObject.DoSomething


DISCLAIMER
----------
This code is provided "AS IS", for illustrative purposes only, and that 
I do not warrant its suitability for any particular purpose.
Written by Bob Snyder <rsnyder@moshannon.com>

