What do the output values from CoGetApartmentType mean?

Raymond Chen

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.