BUG: Blob Persistent Data Incorrect for Ported OLE ControlLast reviewed: July 10, 1997Article ID: Q142211 |
4.00 4.10
WINDOWS NT
kbprg kbole kbbuglist
The information in this article applies to:
SYMPTOMSAn OLE control using PX_Blob(), created using the Control Developer's Kit (CDK) that shipped with Visual C++ 2.2 or earlier and saved in a Visual Basic 4.0 form, may give undefined behavior if the control is ported to Visual C++ 4.0 or 4.1 and the Visual Basic form containing the control is reopened.
CAUSEOLE Controls created using the CDK that shipped with Visual C++ 2.2 or earlier did not implement the IPersistPropertyBag interface. Controls created with Visual C++ 4.0 or 4.1 do implement IPersistPropertyBag. The undefined behavior is due to Visual Basic's implementation of IPropertyBag. Visual Basic is currently adding a 20-byte header to a blob property's persistent data, and expecting that header to be in any blob persistent data previously saved. In the case of controls created previously to Visual C++ 4.0 or 4.1, IPersistPropertyBag, which corresponds to the container's IPropertyBag was not implemented. Therefore, the container used a different means to serialize the blob data which did not attach a 20 byte header. The undefined behavior may behave a number of ways including the blob data being reinitialized, blob data being initialized incorrectly, or the control not being created altogether.
WORKAROUNDTo read in the blob data correctly, you must force the container to use an interface other than IPropertyBag to serialize the data. In this case, a 20-byte header will not be expected and the blob data should be read in properly. The technique demonstrated in the "Sample Code" section of this article unexposes the control's IPersistPropertyBag interface thereby forcing the container to use an interface other than IPropertyBag to read in the blob data.
STATUSMicrosoft has confirmed this to be a bug in Microsoft Visual Basic 4.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Sample Code to Demonstrate WorkaroundThe following is a step by step process to unexpose the IPersistPropertyBag interface in an OLE control generated with Visual C++ 4.0 or 4.1. This is most easily done by implementing a new interface map, which does not expose the IPersistPropertyBag interface.
REFERENCESMFC Technical Note #38 about "MFC/OLE IUnknown implementation" Inside Ole Second Edition by Kraig Brockschmidt
|
Additional reference words: 4.00 4.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |