ThreadTypeDetector Object

Description

Finds the thread type of the current thread.

COM has a complex threading model which allows single threaded objects to be used by multi threaded applications and vice versa. Any given thread must be in a single thread apartment or the multi thread apartment. This object will return which apartment type the current thread is in.

Methods

GetApartmentType

Example

Set ttd = CreateObject("Toolsack.ThreadTypeDetector")
If ttd.GetApartmentType = 2 Then
MsgBox "This is a single apartment thread:"
ElseIf ttd.GetApartmentType = 0 Then
MsgBox "This is thread in the MTA:"
Else
MsgBox "Don't know what kind of thread this is"
End If
 

Samples

Articles



We always want to hear your feedback. Send to feedback@toolsack.com.
© 2000-2001 Toolsack Software Ltd.