COINIT

Determines the concurrency model used for incoming calls to objects created by this thread. This concurrency model can be either apartment-threaded or multithreaded.

Remarks:

When a thread is initialized through a call to CoInitializeEx, you choose whether to initialize it as apartment-threaded or multithreaded by designating one of the members of COINIT as its second parameter.

Apartment-threading, while allowing for multiple threads of execution, serializes all incoming calls by requiring that calls to methods of objects created by this thread always run on the same thread, i.e. the apartment/thread that created them.

Multi-threading (also called free-threading) allows calls to methods of objects created by this thread to be run on any thread. There is no serialization of calls, i.e. many calls may occur to the same method or to the same object or simultaneously.

Notes:

The multi-threaded apartment is intended for use by non-GUI threads. Threads in multi-threaded apartments should not perform UI actions. This is because UI threads require a message pump, and COM does not pump messages for threads in a multi-threaded apartment.

Values

ValueMeaning
APARTMENTTHREADED0x2

Initializes the thread for apartment-threaded object concurrency (see Remarks).

MULTITHREADED0x0

Initializes the thread for multithreaded object concurrency (see Remarks).

DISABLE_OLE1DDE0x4

Disables DDE for OLE1 support.

SPEED_OVER_MEMORY0x8

Increase memory usage in an attempt to increase performance.

Meta