摘要: 在創建COM組件之前,首先必須調用CoInitialize(NULL)初始化COM庫,這個函數的解釋為:Initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA).
接著,就可以通過調用CoCreateInstance函數創建COM組件對象。
當不再使用COM庫時,需要調用CoUninitialize()釋放COM庫。這個函數的解釋為:Closes the COM library on the current thread, unloads all DLLs loaded by the thread, frees any other resources that the thread maintains。
詳細分析CoCreateInstance的具體操作
閱讀全文