BUG: OLE 2.0 Containers & 1.0 Objects that Close w/out Saving

Last reviewed: May 17, 1995
Article ID: Q109547
The information in this article applies to:
  • Microsoft OLE version 1.0
  • Microsoft OLE Libraries for Windows and Win32s, versions 2.0 and 2.01
  • Microsoft OLE Libraries, included with:

        - Microsoft Windows NT, versions 3.5 and 3.51
        - Microsoft Windows 95
    

SYMPTOMS

When an OLE 1.0 object is inserted into an OLE 2.0 container document and then closed without an update being invoked, the correct streams for that object are not written to storage. Any subsequent attempt by the container to load the object will fail.

CAUSE

When the OLE 1.0 object is closed without an update, the OLE 2.0 container receives an IAdviseSink::OnClose() message without having first received an IClientSite::SaveObject() message. Unless the container takes steps to work around this problem, incorrect streams will be saved.

RESOLUTION

To protect against this scenario, OLE 2.0 containers that want data to be available after an OLE 1.0 object closes without updating can implement code similar to the following pseudocode:

   OleCreate();
   OleRun();
   IOleObject::Update();       \\ To get a snapshot of the data.
   OleSave();                  \\ To save the data to storage.
   IOleObject::DoVerb();

Alternatively, the container could just delete any objects that call IAdviseSink::OnClose() without first calling IClientSite::SaveObject().

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post new information here as it becomes available.

MORE INFORMATION

For more information about known idiosyncrasies of embedding or linking OLE 1.0 objects into OLE 2.0 containers, please see the "Compatibility with OLE 1.0" section of the OLE SDK Help file.


Additional reference words: 1.00 2.00 2.01 3.50 4.00 toolkit
KBCategory: kbole kbbuglist
KBSubcategory: LeTwoArc


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 17, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.