Microsoft Windows CE 3.0  

CoInitializeEx

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function initializes the Component Object Model (COM) for use by the current thread. Applications are required to use CoInitializeExbefore they make any other COM library calls except for memory allocation functions.

HRESULT
CoInitializeEx( 
LPVOID
pvReserved
,
DWORD
dwCoInit
);

Parameters

pvReserved
[in] Reserved; set to NULL.
dwCoInit
[in] Specifies the concurrency model and initialization options for the thread. Must be set to COINIT_MULTITHREADED.

Return Values

S_OK indicates that the COM library was initialized successfully. S_FALSE indicates that the COM library is already initialized. The standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED are also supported.

Remarks

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.

The CoInitializeExfunction initializes the Component Object Model (COM), including the OLE library.

The dwCoInitparameter specifies the type of concurrency control required by objects created by this thread. Windows CE supports only the multi-threaded concurrency control. Thus, COINIT_MULTITHREADED is the only option permitted for the dwCoInitparameter.

Compound document applications must call CoInitializeExbefore calling any other function in the OLE library.

Windows CE does not support the CoInitialize( NULL )or OleInitializefunction. Use CoInitializeExinstead.

Passing into this function any invalid and, under some circumstances, NULL pointers result in unexpected termination of the application.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later Objbase.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CoUninitialize