Microsoft KB Archive/165490

= VB4 16-Bit OLE Clients Receive Error -2147319784 =

Article ID: 165490

Article Last Modified on 8/5/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q165490



SUMMARY
When using an existing 16-bit application compiled with Microsoft Visual Basic version 4.0, the following error message may be displayed if you are working with a Visual Basic 4.0 16-bit-built OLE client:

OLE Automation Error. -2147319784 (80028018)

During the installation of Microsoft Office 97 and Microsoft Visual Basic 5.0, updated components and registrations entries may cause the above error message only if you are using early binding and passing Collections from a Visual Basic 4.0 16-bit Automation client to a Visual Basic 4.0 Automation server. The server can be either 16-bit or 32-bit.

This applies to any combination of 16-bit / 32-bit collection interaction. This means that the same problem will occur if the collection originates and is passed from a 32-bit application to a 16-bit server as well. There are two ways to work around this behavior:

Workaround 1 - When Source Code is Available (Best Solution)
To work around this behavior when you have the source code available, you can re-write portions of the client that deal with collections to use late binding rather of early binding. For example, a change you would make to the Automation Client is:

instead of: Dim X as Collection use: Dim X as Object Set X = VBA.Collection

Workaround 2 - Existing Applications and No Access to Source Code
To work around this behavior in the situation where an existing, compiled application is affected, certain changes must be made to the Registration Database. These changes force TYPELIB.DLL to use the earlier versions of the type libraries that released with Microsoft Visual Basic 4.0. A registry file has been created by Microsoft that will change the registration automatically.

The following files are available for download from the Microsoft Download Center:

Vb416fix.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Updating an Individual System
To update any single system, do the following:

 Copy the VB416FIX.EXE to a directory on the target system. C:\TEMP works well. Double-click on VB416FIX.EXE to extract the file VB416FIX.REG. Double-click on the VB416FIX.REG.

The following message should be displayed:

"Information in has been successfully entered into the registry."



Including the VB416FIX.REG File in New Setups
To include the VB416FIX.REG file with the other components of a Visual Basic 4.0 16-bit application, you must use the Application Setup Wizard to build the distribution diskettes. Use the following steps:

 Run the Application Setup Wizard for Microsoft Visual Basic 4.0 (16-bit). Proceed through step 6 in the Setup Wizard as you normally would. In step 7 in the Setup Wizard, click Add Files.</li> Select the VB416FIX.REG file from the folder or diskette where it is stored.</li> Click OK, and then click Finish.

The Setup Wizard will generate the compressed files for all of your components, including the VB416FIX.REG file you included. When Setup Wizard is complete, you must alter the SETUP.LST file.</li> Edit SETUP.LST in a text editor such as NotePad.</li>  In the section labeled [Files], you will find a line that lists the VB416FIX.REG file The line will look similar to the following sample: <pre class="fixed_text">     File2=1,,VB416FIX.RE_,VB416FIX.REG,$(AppPath),,,3/6/1997,247 </li>  Edit the sixth (6) field to include the name of the .REG file. The line should look like the following: <pre class="fixed_text">  File2=1,,VB416FIX.RE_,VB416FIX.REG,$(AppPath),VB416FIX.REG,,3/6/1997,247 </li> Save the SETUP.LST file.

When a user runs the SETUP.EXE, the VB416FIX.REG file will be registered automatically on the user's system.</li></ol>

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

<div class="moreinformation_section">

MORE INFORMATION
During the installation of Microsoft Office 97 and Microsoft Visual Basic 5.0, updated components and registrations entries may cause the above error message only if you are using early binding and passing Collections from a Visual Basic 4.0 16-bit Automation client to a Visual Basic 4.0 Automation server. The server can be either 16-bit or 32-bit. This is limited to Visual Basic 4.0 16-bit built clients that use early binding and pass a Collection to an Automation server.

Steps to Reproduce Behavior
 Create a new project in Visual Basic 4.0 16-bit:

(ProjectName="TestServer", StartMode= OLE Server)

</li> Add a Class module:

(Instancing = Multi-Use, Name = "Class1", Public = True)

</li>  Add the following code to Class1: Private gTstCol as New Collection

Public Function fTstCol(ByRef ParCol As Collection) As Long Set ParCol = gTstCol 'Return some global collection object fTstCol = 0 'just return 0, nothing special. End Function </li> Run Project.</li> Start another instance of Visual Basic 4.0 16-bit.</li> Add a reference to TestServer to the project.</li>  Add the following code to the project: Sub Form_Load Dim gTstObj As TestServer.Class1 Dim Res As Long Dim tmpCol As Collection Set gTstObj = new "TESTSERVER.CLASS1" Res = gTstObj.fTstCol(tmpCol) 'The Automation Error message is displayed in the line above. End Sub </li> Run the Project.</li></ol>

Keywords: kbdownload kbpatch kbprogramming kbfile kbprb KB165490

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.