Microsoft KB Archive/199385

= PRB: Active OLE Control Prevents Logging Off or Shutting Down =

Article ID: 199385

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q199385



SYMPTOMS
When an OLE control with an embedded OCX control is active, the application prevents logging off or shutting down a machine. OLE cancels shutdown before your Visual Basic application gets a Query Unload event.



CAUSE
To prevent data loss, OLE prevents exiting an application while an OLE provider is active for editing.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Create a new ActiveX Control project in Visual Basic. UserControl1 is created by default. Place a CommandButton (Command1) on to UserControl1.  Paste the following code into the code module for UserControl1: Private Sub UserControl_Resize Command1.Move 0, 0, ScaleWidth, ScaleHeight End Sub  From the File menu, select Make Project1.ocx to compile Project1. Create a new Standard EXE project (save the changes to the ActiveX Control project, if desired), add a reference to the just-created OCX by selecting it from the Components window. Note that you need to change the project name in order to add the Project1 control. Place an instance of the OLE control onto Form1. The control is given the name OLE1 by default. Leave the OLE control empty.</li>  Paste the following code into the code module for Form1: Private Sub Form_Load OLE1.CreateEmbed "", "Project1.UserControl1" OLE1.DoVerb vbOLEShow End Sub </li> Run the application, and click on OLE1 to activate the control.</li> Log off or shut down the system. Note that you cannot log off or shut the machine down because the ActiveX control is active for editing.</li></ol>

Keywords: kboleapp kbprb KB199385

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.