CoInitializeEx正确判断方式

    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    //hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

	// Multiple calls to CoInitializeEx by the same thread are allowed as long
	// as they pass the same concurrency flag, but subsequent valid calls
	// return S_FALSE. To close the COM library gracefully on a thread, each
	// successful call to CoInitializeEx, including any call that returns
	// S_FALSE, must be balanced by a corresponding call to CoUninitialize.
	if (hr == S_OK) {
		TSK_DEBUG_INFO("The COM library was initialized successfully on this thread");
	}
	else if (hr == S_FALSE) {
		TSK_DEBUG_INFO("The COM library is already initialized on this thread");
	}

 

你可能感兴趣的:(VC++,基础学习)