FILE: ADOREGEX.EXE: Components to Redistribute ADO 1.0/1.1

ID: Q172406


The information in this article applies to:


SUMMARY

ADOREGEX.EXE is a self-extracting compressed file that contains a supplemental .dll file and a fix to ADO 1.1 to allow you to redistribute ADO/DB components safely when you use the Application Setup Wizard to create your setup program.

This article is one of a series dealing with redistribution of MDAC components, i.e. ODBC, OLE DB, ADO, RDS, the MDAC Standalone, MDAC Redistribution, and the Data Access SDK. The white paper "Redistributing Microsoft Data Access Components" presents a comprehensive overview of this subject, including referencing the content in this Knowledge Base article.

This white paper is located at:

http://www.microsoft.com/msdn/news/feature/datajul98/redistmdac.htm


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

~ AdoRegEx.exe

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

Q119591 : How to Obtain Microsoft Support Files from Online Services


You will want to unzip AdoRegEx.exe with the -d switch to correctly extract the following sub-directories:

This article discusses in detail how to use AdoRegEx.DLL with the Visual Basic Application Setup Wizard. Specific topics include:
This discussion assumes you have installed ADO/DB on your machine already, typically by downloading the OLE-DB SDK, which is available free on the Web at:
http://www.microsoft.com/oledb

How ADO and the Application Setup Wizard Interact

Currently, it is not possible to correctly install ADO/DB components with the Visual Basic Setup Wizard for Visual Basic 5.0 applications. This is due to several limitations in both ADO/DB required components and the Visual Basic Setup Wizard described below:

Distributing ADO with the Application Setup Wizard w/AdoRegEx.DLL

To redistribute your own ADO/DB based project, complete each of the following steps. You can safely ignore warnings about no dependency information for ADODB and the AdoRegEx.DLL files:
  1. Download the ADO 1.1 QFE. You will want to rename the QFE file (typically XENGLISH.EXE) to Ado1Dist.exe.


  2. Open the Application Setup Wizard on your project.


  3. By default, in the "ActiveX Server Components" step, MSADO10.DLL is checked. Uncheck it. You do this because MSADO10.DLL will be registered by the Setup Wizard in the wrong location. AdoRegEx.DLL will move MSADO10.DLL, and other ADODB DLLs to the correct location and register them there.


  4. In the File Summary Step, add this file:

    Ado1Dist.exe


  5. While still in the File Summary Step, add the following file: (NOTE: It must be the last file in the list.)

    AdoRegEx.dll


  6. In the final step, save as a template. You can generate the distribution now although you will be modifying it shortly.


  7. Edit the Application Setup Wizard Template File (.SWT). A portion is shown below for the VBTEST project. Note that AdoRegEx is the last file for the entire distribution and that the second-to-last parameter ensures that the component self-registers. Modifications to this file affect future builds for this particular project, but do not affect the setup that the Setup Wizard just built. The following step does that:
    
          File8="C:\AdoTest\Ado1Dist.exe",True,"$(WinSysPath)",,False
                                               ^^^^^^^^^^^^^^^
                Change Ado1Dist.exe so it installs in the Windows System Path,
                and *NOT* the Application Path.
    
          File9="C:\ADOTest\AdoRegEx.dll",True,"$(WinSysPath)",
                $(DLLSelfRegister),True        ^^^^^^^^^^^^^^^
                 ^^^^^^^^^^^^^^^^^
    
          NOTE: Your source location for AdoRegEx.DLL and Ado1Dist.EXE may vary
          from what is shown above.
     


  8. You will also want to modify the SETUP.LST file so that AdoRegEx.DLL is self-registering and so that Ado1Dist.exe is installed in the windows system directory. This is shown below in the fragment from the SETUP.LST file. Again, modify the second-to-last parameter to ensure that the component self-registers:
    
          File15=1,,Ado1Dist.ex_,Ado1Dist.exe,$(WinSysPath),...
          File16=1,,AdoRegEx.dl_,AdoRegEx.dll,$(WinSysPath), _
               $(DLLSelfRegister)...
     


  9. Distribute your application. AdoRegEx.DLL creates a log file in the same directory in which it is placed, informing you in detail of the success or failure of its attempt to install ADODB on the target machine. In addition, a quick check of the registry confirms whether the ADO license key was created, which is the last step AdoRegEx.DLL performs. This check can be done by examining if the following key exists:
    
          \HKEY_CLASSES_ROOT
             \LICENSES
                 \CEDD4F80-B43C-11cf-837C-00AA00573EDE
     
    and check if it has the following value:
    
          gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz
     


Does Your VB Application Need the ADO License Key?

The ADO 1.1 QFE adds the ADO License key automatically to any system to which it is distributed. However, it is important to understand when the license key is necessary and when it is not. The license key is automatically installed by the OLE-DB SDK and other Microsoft products that install ADO and OLE-DB.

NOTE: No matter what mechanism you use to create ADO objects, the license key is needed on your development machine. You need to know whether your application needs it at compile time or at run-time.

You can distribute ADO to a machine that has ADO and OLEDB and no license key if you create your ADO objects using early binding, as shown in the two code snippets below:

   // Technique #1  (Early Binding)
   dim rs1 as new ADODB.Recordset

   // Technique #2  (Early Binding)
   dim rs1 as ADODB.Recordset
   set rs1 = new ADODB.Recordset 

At compile time, the check for the license key is made. The next code snippet does not test for the license key at compile time:

   // Technique #3  (Late Binding)
   Dim rs1 as ADODB.Recordset
   set rs1 = CreateObject( "ADODB.Recordset" ) 

This technique performs late binding, which means that the check for the license key will not be made until run-time. Therefore, when you distribute your EXE file, the target machine will need to have the ADO License Key. If you do not have the license key at run-time, an exception will be caught by the Visual Basic Err object with error code #429:
"ActiveX component can't create object"

For this reason, if at all possible, do not use CreateObject.

About AdoRegEx.DLL

The complete source for AdoRegEx.dll is provided. With the release of the ADO 1.1 QFE, though, the source for AdoRegEx.dll shrank dramatically. The original version, which individually installed and registered each of the ADO/DB DLLs, is provided for reference, but it is not supported and users are not encouraged to use it.

Additional query words: adovb


Keywords          : 
Version           : WINDOWS:5.0
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: May 12, 1999