Error When Referring to Member Object/Collection in OLE DLLLast reviewed: May 20, 1996Article ID: Q143261 |
The information in this article applies to:
SUMMARYAssigning an object dimensioned in a client application to a Public member object inside an OLE DLL, or referencing a property of the member object may give a General Protection Fault or OLE Automation Error depending upon how the member object was declared and whether or not it has been instantiated. The problem discussed in this article only occurs when the server is compiled as an OLE DLL (In-Proc server) and the client has been compiled as an EXE.
STATUSMicrosoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
More InformationThe General Protection Fault can occur if the member object was constructed by declaring it as a property using the New keyword in the declarations section of a class module, and if the DLL code has not instantiated the object by referring to a property or method of that object before the client application is accessing the member object. In a class module, it is possible to create a member object by placing a declaration like so:
Public x as New Class2Here x is a member object (of type Class2). However, it will not be instantiated until a property or method of x is invoked. The problem discussed in this article is that x may not be correctly instantiated if a property or method of x is first used in the client application, and x is a member object contained in an OLE DLL. Under these circumstances, a General Protection Fault or OLE Automation Error may occur.
WorkaroundBy implementing the member object property so that it is instantiated upon startup of the parent class to the member, this problem can be avoided.
Steps to Reproduce ProblemCreate the OLE Server Application:
Create the Client Application
On Windows 95, a General Protection Fault generally occurs (in one test this occurred in Vb40032.dll at 0137:0f7269d9). On Windows NT 3.51, a General Protection Fault can occur, and also a Run-time error '-2146500594 (800f000e)' can occasionally occur. Notably, the General Protection Fault or OLE Automation Error does not occur if the client application is run from the Design Environment, or if the OLE Server is implemented as an Out-of-Proc (EXE) OLE server. Another example of reproducing a General Protection Fault can occur if a Collection object is a member object of the OLE DLL, and if the Client application refers to the Count property of the Collection object before the member collection object has been instantiated (the count of the Collection object will be zero when this is the case).
|
Additional reference words: 4.00 vb4win vb432 gpf gp-f check box
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |