FIX: OLE Server Terminate Not Fired If Client Uses 'End' (129885)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q129885 SYMPTOMS
An OLE Server with loaded forms does not unload when the client program
terminates by using the End statement, even if the OLE server is programmed
to unload its forms in the Terminate event.
CAUSE
When you use End to shut down an object application, the Terminate events
of objects are NOT executed. (This is analogous to forms -- if you use
End, the QueryUnload, Unload, and Terminate events of forms are NOT
executed.)
RESOLUTION
This behavior occurs under Microsoft Windows 95, Microsoft Windows version
3.X, and Microsoft Windows for Workgroups version 3.11. It does not occur
under Microsoft Windows 98 or Microsoft Windows NT.
Good programming uses the Terminate event of a class module to clean up and
release dependent object references. This is true for client applications
that create OLE objects as well. The Terminate, QueryUnload, or Unload
events gracefully close down any objects or forms that were created or
loaded during the session.
The End statement is convenient, but it does NOT go through the complete
sequence of cleaning up after your application. You should use it
cautiously and sparingly when developing applications.
A Visual Basic client can destroy the last instance of an OLE Server it
creates by: - Setting it to Nothing (the preferred method).
- Shutting down by unloading the last form (acceptable, but not as
desirable).
- Ending the program by executing the End statement (this can cause
problems).
STATUS
This problem has been fixed in Microsoft Windows 98.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbBug kbfix kbOSWin98fix KB129885 |
---|
|