The information in this article applies to:
- Microsoft Visual Basic Professional and Enterprise Editions for
Windows, version 5.0
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.
MORE INFORMATION
The following file is available for download from the Microsoft Software
Library:
~ AdoRegEx.exe (size: 2542653 bytes)
For more information about downloading files from the Microsoft Software
Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591
TITLE : 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:
- AdoRegEx - Visual C++ source project to create AdoRegEx.DLL.
- VbTest - Sample Visual Basic project and .SWT file to create
a Visual Basic Distribution that correctly installs ADO and
OLE-DB.
- Setup - A complete ADO Redistribution using the AdoRegEx.dll,
the ADO 1.1 QFE, and the VBTest project.
This article discusses in detail how to use AdoRegEx.DLL with the Visual
Basic Application Setup Wizard. Specific topics include:
- How ADO and the Application Setup Wizard Interact
- Distributing ADO with the Application Setup Wizard w/AdoRegEx.DLL
- Does Your VB Application Need the ADO License Key?
- About AdoRegEx.DLL
- About VBTEST Sample
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
It also assumes you have downloaded the QFE, as described in the following
Knowledge Base Article:
ARTICLE-ID: Q173487
TITLE : INFO: ADO 1.1 QFE Download Now Available (Updates ADO 1.0)
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:
- ADO and OLE-DB components, for future compatibility, must be registered
in specific locations, such as:
\program files\common files\system\ado
\program files\common files\system\ole db
- When registering a DLL, the Visual Basic Setup Wizard does not change
directory to the location of the DLL being registered.
- The OLE-DB DLL, MSDATL.DLL, which is required for other OLE-DB
components that ADO uses to register, is not self-registering. When
Visual Basic attempts to register those DLLs, it cannot find
MSDATL.DLL in the "...\OLE DB" directory. As a result of the failure
to register those files, ADO will also fail to register.
This has been corrected with a supplemental DLL (AdoRegEx.DLL) and by
the ADO 1.1 QFE, which also acts as a redistribution mechanism for
ADO/DB 1.0. AdoRegEx.DLL, used with the QFE, can provide a complete
setup solution for the Visual Basic Setup Wizard.
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:
- Download the ADO 1.1 QFE. You will want to rename the QFE file
(typically XENGLISH.EXE) to Ado1Dist.exe.
- Open the Application Setup Wizard on your project.
- 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.
- In the File Summary Step, add this file:
Ado1Dist.exe
- While still in the File Summary Step, add the following file: (NOTE: It
must be the last file in the list.)
AdoRegEx.dll
- In the final step, save as a template. You can generate the
distribution now although you will be modifying it shortly.
- 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.
- 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)...
- 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.
|