The OleInitialize function initializes the
OLE library. You must initialize the library before you can call
OLE functions.
HRESULT OleInitialize(
LPVOID pvReserved //Reserved, must be NULL
);
Parameter
pvReserved
In 32-bit
OLE, this parameter must be NULL. The 32-bit version of
OLE does not support applications replacing
OLE's allocator and if the parameter is not NULL, OleInitialize returns E_INVALIDARG.
Return Values
S_OK
Indicates the library was initialized successfully.
S_FALSE
Indicates
OLE library is already initialized; a pointer to the IMalloc implementation was not used.
OLE_E_WRONGCOMPOBJ
Indicates COMPOBJ.DLL is the wrong version for OLE2.DLL.
E_OUTOFMEMORY
Indicates the library was not initialized because the system was out of memory.
E_INVALIDARG
Indicates an argument was invalid.
E_UNEXPECTED
Indicates an unexpected error occurred.
Comments
Applications must call OleInitialize before calling any other function in the
OLE library.
Typically, OleInitialize is called only once in the process that uses the
OLE library. There can be multiple calls, but subsequent calls return S_FALSE. To close the library gracefully, each successful call to OleInitialize, including those that return S_FALSE, must be balanced by a corresponding call to the OleUninitialize function.
See Also
OleUninitialize, CoInitialize