Application.CurrentThread
From Xojo Documentation
Read-Only Property (As Thread )
Obtains the currently running Thread.
Notes
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.