Call CoUninitialize or OleUninitialize

After an application has finished with the COM/OLE DLLs, it must call CoUninitialize if it previously called CoInitialize or OleUninitialize if it previ-ously called OleInitialize. Neither function takes any arguments. You must uninitialize only if initialization worked, to ensure that everything is balanced inside the DLLs. The uninitialize functions check that all pending OLE calls across process boundaries have cleared, ensuring that the states of all components are cleaned up completely before a task terminates. One part of the process is a call to CoFreeAllLibraries, which checks that any DLL servers for components loaded into this task are properly unloaded. We'll see the effect of this unloading process in Chapter 5.