Microsoft KB Archive/110801

From BetaArchive Wiki

BUG: Contain Sample Draws Incorrectly with In-place Server

Q110801


The information in this article applies to: - The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++ for Windows, version 1.5 ---------------------------------------------------------------------- SYMPTOMS ======== The Contain sample step 2, which is included with Visual C++ version 1.5 for Windows, has a bug that causes incorrect drawing of the OLE object when the server is in-place activated (not when it is out-of-place activated). The problem is apparent after the embedded OLE object is shrunk and then reactivated. When the user starts drawing in the embedded object again, a shaded region will be drawn with a sizing rectangle which is the size and location of the embedded object before it was resized. CAUSE ===== Step 2 of the Contain sample is intended to show how to do efficient redrawing and repainting with an OLE Container application. The cause of the problem is in the code which has been implemented to resize the OLE object properly when an out-of-place server has resized the view. Step 2 correctly implements this for an out-of-place server. The Contain tutorial in the OLE 2 Classes Manual mentions HIERSVR as an example. However, if an in-place activated server is used to embed an OLE object then the resizing code is incorrect. If the server is in-place activated then there is no need to resize the OLE object. The current implementation will again resize the OLE object by retrieving the extents from the server. In the case of an in-place activated server, the extents are not likely to change and the object will be drawn with its old size. RESOLUTION ========== To fix the problem, make the following code change: On Page 37 of "OLE 2 Classes" or in the file CNTRITEM.CPP change: void CCntrItem::UpdateFromServerExtent() { ... >>> if (size != m_rect.Size()) ... -to- if (size != m_rect.Size() && !IsInPlaceActive()) STATUS ====== Microsoft has confirmed this to be a problem in the Contain sample of the Microsoft Foundation Classes version 2.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. Additional query words: shaded re-size sizing

Keywords : kbole kb16bitonly kbMFC kbVC
Issue type : kbbug
Technology : kbAudDeveloper kbMFC


Last Reviewed: May 5, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.