Click here to Skip to main content
14,453,401 members

ATL / WTL / STL

 
QuestionChakra: IActiveScript::GetScriptDispatch() fails with E_OUTOFMEMORY Pin
imagiro3-Jul-13 23:13
Memberimagiro3-Jul-13 23:13 
QuestionActiveX in ActiveX problem Pin
leisuregame1-Jul-13 23:29
Memberleisuregame1-Jul-13 23:29 
QuestionCOM Apartment Pin
KRISHNARAYALU16-Jun-13 21:46
MemberKRISHNARAYALU16-Jun-13 21:46 
AnswerRe: COM Apartment Pin
Richard MacCutchan16-Jun-13 21:57
communityengineerRichard MacCutchan16-Jun-13 21:57 
GeneralRe: COM Apartment Pin
KRISHNARAYALU16-Jun-13 22:10
MemberKRISHNARAYALU16-Jun-13 22:10 
GeneralRe: COM Apartment Pin
Richard MacCutchan16-Jun-13 22:24
communityengineerRichard MacCutchan16-Jun-13 22:24 
GeneralRe: COM Apartment Pin
KRISHNARAYALU16-Jun-13 22:35
MemberKRISHNARAYALU16-Jun-13 22:35 
AnswerRe: COM Apartment Pin
imagiro4-Jul-13 3:53
Memberimagiro4-Jul-13 3:53 
First of all an apartment is an abstract concept, means, there is no physical thing behind. When a thread starts it decides in which apartment it wants to "live". It does so by calling CoInitialize or CoInitializeEx.

An apartment is a kind of a convention how to handle things. A thread that initializes a single-threaded apartment states, that it does not allow any other threads to enter the same apartment. COM knows then, that all objects living in this apartment can be accessed only from this same thread and makes sure that these objects are used only from within this thread.

A thread that initializes a multi-threaded apartment allows other threads. COM knows then, that multiple threads might access the objects in this apartment and relies on these objects to handle thread synchronization by themselfs.

So how do other threads enter the same apartment? Simply also via CoInitializeEx. By requesting a multi-threaded apartment they will automatically resist in the same apartment as the other MTA threads since there can only be one MTA.

So in the end each thread that initializes a STA creates its own apartment, while threads initializing MTA enter the one and only MTA. And the same is of course valid for all COM objects created from this thread.
AnswerRe: COM Apartment Pin
Krishnakumartg13-Aug-13 7:53
MemberKrishnakumartg13-Aug-13 7:53 
Questionhow to export an enum type in an ATL prject Pin
astupidboy12-Jun-13 22:58
Memberastupidboy12-Jun-13 22:58 
AnswerRe: how to export an enum type in an ATL prject Pin
Jonathan Davies15-Jun-13 5:10
MemberJonathan Davies15-Jun-13 5:10 
QuestionHere is a C Program showing some Error, Give some solution Pin
Member 969295410-Jun-13 5:03
MemberMember 969295410-Jun-13 5:03 
AnswerRe: Here is a C Program showing some Error, Give some solution Pin
Richard MacCutchan10-Jun-13 7:03
communityengineerRichard MacCutchan10-Jun-13 7:03 
AnswerRe: Here is a C Program showing some Error, Give some solution Pin
Krishnakumartg13-Aug-13 8:05
MemberKrishnakumartg13-Aug-13 8:05 
Questionstd::map and error checking Pin
bkelly139-Jun-13 11:42
Memberbkelly139-Jun-13 11:42 
AnswerRe: std::map and error checking Pin
Garth J Lancaster9-Jun-13 14:18
professionalGarth J Lancaster9-Jun-13 14:18 
GeneralRe: std::map and error checking Pin
bkelly139-Jun-13 15:16
Memberbkelly139-Jun-13 15:16 
AnswerRe: std::map and error checking Pin
Richard MacCutchan9-Jun-13 22:23
communityengineerRichard MacCutchan9-Jun-13 22:23 
AnswerRe: std::map and error checking Pin
MicroVirus11-Jun-13 13:07
MemberMicroVirus11-Jun-13 13:07 
Questionstatus display in a dialog Pin
bkelly139-Jun-13 6:17
Memberbkelly139-Jun-13 6:17 
AnswerRe: status display in a dialog Pin
Garth J Lancaster9-Jun-13 15:53
professionalGarth J Lancaster9-Jun-13 15:53 
Questionstd::map, fundamental get started problem RESOLVED Pin
bkelly139-Jun-13 5:04
Memberbkelly139-Jun-13 5:04 
AnswerRe: std::map, fundamental get started problem Pin
pasztorpisti9-Jun-13 5:19
professionalpasztorpisti9-Jun-13 5:19 
GeneralRe: std::map, fundamental get started problem RESOLVED Pin
bkelly139-Jun-13 5:46
Memberbkelly139-Jun-13 5:46 
QuestionCFileException, discover reasons RESOLVED Pin
bkelly138-Jun-13 11:05
Memberbkelly138-Jun-13 11:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.