C++ Builder - Spawn TThreads On the Fly

1.1k Views Asked by At

I'm looking for the ability to spawn a thread or function so that it returns immediately to the calling line and continue on with the program but continues with the thread work.

For instance, if you call Form.ShowDialog(), it will create a modeless form that has its own UI thread.

Is there a way to do this (no form) without having to declare a TThread class? I guess sort of like an anonymous thread, if that even exists.

1

There are 1 best solutions below

1
On BEST ANSWER

I don't know exactly why you don't want to create a TThread subclass, but if you are using the Windows version of C++ Builder you can use the _beginthreadex function (declared in process.h).