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