CoUninitialize
Closes the
OLE Component Object Model (COM) library, freeing any resources that it
maintains and forcing all RPC connections to close.
void
CoUninitialize();
Remarks
The CoInitialize and CoUninitialize
calls must be balanced - if there
are multiple calls to the CoInitialize function, there must be the same
number of calls to CoUninitialize. Only the CoUninitialize call
corresponding to the CoInitialize call that initialized the library can
close it.
The OleUninitialize
function calls CoUninitialize internally, so applications that call OleUninitialize
do not also need to call CoUninitialize.
CoUninitialize should be called on application shutdown, as the last
call made to the COM library after the application hides its main windows and falls
through its main message loop. If there are open conversations remaining, CoUninitialize
starts a modal message loop and dispatches any pending messages from the
containers or server for this OLE application. By dispatching the messages, CoUninitialize
ensures that the application does not quit before receiving all of its
pending messages. Non-OLE messages are discarded.
See Also