In a multi-threaded environment with ADO database connections, I would like to know if CoInitialize has been called or not. How would I go about checking this?
In a multi-threaded environment with ADO database connections, I would like to know if
Share
Normally you should not do this check and just call
CoInitialize/CoUnInitializepair. Still you can do it like this:There is no problem if you call
CoInitializemore than once in a thread. The first call should returnS_OK, all subsequent calls should returnS_FALSE. All these calls are considered successful and should be paired byCoUnInitializecalls. If you calledCoInitializen times in a thread, only the last n-thCoUnInitializecall closes COM.