From Xojo Documentation

Read-Only Property (As Thread )
ThreadValue = aApplication.CurrentThread

Supported for all project types and targets.

Obtains the currently running Thread.


If the current Thread is the main thread (the thread that is used internally to run the application and its UI), CurrentThread returns Nil.

Sample Code

This code gets the ID of the currently running thread, which should be the main thread.

Dim t As Thread = App.CurrentThread
If t <> Nil Then
MsgBox("The Thread ID is " + Str(t.ThreadID))
MsgBox("The thread is the main thread")
End If