CoInitializeEx function

来源:互联网 发布:萨尔 知乎 编辑:程序博客网 时间:2024/06/04 19:32

CoInitializeEx function
HRESULT CoInitializeEx(
In_opt LPVOID pvReserved,
In DWORD dwCoInit
);
Initializes the COM library for use by the calling thread, sets the thread’s concurrency model, and creates a new apartment for the thread if one is required.

CoInitializeEx是 Windows提供的API函数,为当前线程初始化COM库并设置并发模式 。应用程序调用com库中的函数(除CoGetMalloc和内存分配函数)之前必须初始化com库。

You should call Windows::Foundation::Initialize to initialize the thread instead of CoInitializeEx if you want to use the Windows Runtime APIs or if you want to use both COM and Windows Runtime components. Windows::Foundation::Initialize is sufficient to use for COM components.

Parameters

pvReserved [in, optional]
This parameter is reserved and must be NULL.
dwCoInit [in]
The concurrency model and initialization options for the thread. Values for this parameter are taken from the COINIT enumeration. Any combination of values from COINIT can be used, except that the COINIT_APARTMENTTHREADED and COINIT_MULTITHREADED flags cannot both be set. The default is COINIT_MULTITHREADED

原创粉丝点击