DOCUMENT:Q186270 30-MAY-1998 [vbwin] TITLE :BUG: Tab Control Containing OLE Control May Crash PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,97,97sp2,97sp3 OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 - Microsoft Visual Studio versions 97, 97sp2, 97sp3 --------------------------------------------------------------------- SYMPTOMS ======== On a Visual Basic form, an OLE control is placed on a Microsoft Tabbed Dialog control. You write code to embed a file into the OLE control using the CreateEmbed method. When the user clicks the tab that contains the OLE control, one of the following errors occur and the application terminates: VB5 caused an invalid page fault in module TABCTL32.OCX at 0137:212f8b26. -or- executed an invalid instruction in module OLE32.DLL at 0137:65fa93ae. -or- Exception: Access violation (0xc0000005), Address: 0x212f8b26 RESOLUTION ========== To work around this problem, do one of the following: - Place the OLE control inside a Frame control. -or- - Make the Tab that contains the OLE control the active tab before using the CreateEmbed method. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Create a new Standard EXE project. Form1 is created by default. Choose Components from the Project menu and add a reference to the "Microsoft Tabbed Dialog Control 5.0." 2. Add an SSTab control to Form1. By default, there will be three tabs named Tab0, Tab1 and Tab2. Add a CommandButton to Form1. 3. Add an OLE control to the first tab, Tab0, of the SSTab control. Choose Cancel when prompted to insert an object. 4. Paste the following code into the code window of Form1: Private Sub Command1_Click() 'Set the current tab to the second tab SSTab1.Tab = 1 'Embed a bitmap into the OLE control OLE1.CreateEmbed "C:\VB5\Graphics\Bitmaps\Assorted\Envelope.bmp" End Sub 5. Change the path in the code above to a valid BMP file on your system. 6. Save and run the project. 7. Click Command1. Click Tab0 and note that the OLE control displays the bitmap file. 8. Click Command1 and then click Tab0. Note that Visual Basic terminates with one of the errors mentioned above. If no problem occurs, repeat steps 7 and 8. If the problem still does not occur, try restarting Visual Basic and repeat the steps beginning at step 6. This problem will also occur when running the project as a compiled exe. Workaround ---------- To work around this problem, put a Frame control on Tab0 and then put the OLE control inside the Frame control. Size the Frame control so it is large enough to accommodate the OLE control and set the Borderstyle property of the Frame control to 0 if you wish to hide the Frame's border and caption. Additional query words: ipf OLE container kbVBp500bug kbVBp500 kbVS97bug kbVS97sp2bug kbVS97sp3bug kbDSupport kbDSD kbCtrl kbUsage ====================================================================== Version : WINDOWS:5.0,97,97sp2,97sp3 Platform : WINDOWS Issue type : kbbug Solution Type : kbpending ============================================================================= 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. Copyright Microsoft Corporation 1998.