CoInitialize

HRESULT CoInitialize(pReserved)

Initialize the Common Object Model library so that it can be used. With the exception of CoBuildVersion, this function must be called by applications before any other function in the library. Calls to CoInitialize must be balanced by corresponding calls to CoUninitialize. Typically, CoInitialize is called only once by the process that wants to use the COM library, although multiple calls can be made. Subsequent calls to CoInitialize return S_FALSE.

Argument

Type

Description

pReserved

void*

Reserved for future use. Presently, must be NULL.


Return Value

Meaning

S_OK

Success. Initialization has succeeded. This was the first initialization call in this process.

S_FALSE

Success. Initialization has succeeded, but this was not the first initialization call in this process.

E_UNEXPECTED

An unknown error occurred.