ConsoleApplication.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 it used internally to run the application), CurrentThread returns Nil.
Sample Code
This code gets the ID of the currently running thread, which should be the main thread.