RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
ComObj.CoInitFlags Variable

Specifies the level of threading support requested for a COM server .EXE.

Pascal
CoInitFlags: Integer = -1;
C++
int CoInitFlags = -1;

ComObj

CoInitFlags controls the way COM is initialized for threading support. This variable only affects executables (.EXEs), not in-process servers (.DLLs and .OCXs). 

Typically, code to initialize the level of threading support is added automatically by the wizard that creates the COM object in your application. In applications containing multiple COM objects, COM is initialized for the highest level of support, where single threading is lowest and free threading is highest. To manually set the level of COM threading support, assign a value to CoInitFlags in the program’s main source file before the call to Application.Initialize. 

The following table lists the constants (defined in the ActiveX unit) that can be or’ed together to create a value for CoInitFlags. 

ConstantValueMeaning

Constant 
Value 
Meaning 
COINIT_MULTITHREADED  
0  
COM calls objects on any thread (free threading)  
COINIT_APARTMENTTHREADED  
2  
Each object has its own thread (apartment model)  
COINIT_DISABLE_OLE1DDE  
4  
Don't use DDE for Ole1 support.  
COINIT_SPEED_OVER_MEMORY  
8  
Optimize for speed rather than memory.  

The value of CoInitFlags is –1 for single threading. 

 

TApplication 

IsMultiThread

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!