PRB: Active OLE Control Prevents Logging Off or Shutting Down
ID: Q199385
|
The information in this article applies to:
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0
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.
MORE INFORMATION
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.
- Paste the following code into the code module for Form1:
Private Sub Form_Load()
OLE1.CreateEmbed "", "Project1.UserControl1"
OLE1.DoVerb vbOLEShow
End Sub
- Run the application, and click on OLE1 to activate the control.
- 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.
Additional query words:
Keywords : kbole kbOLEApp kbVBp kbVBp500 kbVBp600 kbGrpVB kbDSupport
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbprb