February 8th, 2018

What do the output values from CoGetApartmentType mean?

The Co­Get­Apartment­Type function returns two pieces of information, documented as follows:

  • APT­TYPE enumeration value that specifies the type of the current apartment.
  • APT­TYPE­QUALIFIER enumeration value that specifies the type qualifier of the current apartment.

The possible combinations can be deduced from the documentation for APT­TYPE­QUALIFIER, but here they are in table form because people like tables.

Apartment Type Qualifier Meaning
STA NONE Single-threaded apartment
STA APPLICATION_STA Non-reentrant single-threaded apartment
MAINSTA NONE Main single-threaded apartment
MTA NONE Multithreaded apartment, explicitly initialized
MTA IMPLICIT Multithreaded apartment, implicitly initialized
NA NA_ON_STA Neutral apartment entered on STA thread
NA NA_ON_MAINSTA Neutral apartment entered on main STA thread
NA NA_ON_MTA Neutral apartment entered on explicit MTA thread
NA NA_ON_IMPLICIT_MTA Neutral apartment entered on implicit MTA thread

More details can be found in the documentation for APT­TYPE­QUALIFIER.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.