Possible Duplicate:
What are the other threads in a default VCL application, and can they be named by purpose?
When running a new empty VCL Forms Application in Delphi XE2 (32bit), I see 4 threads running in the Task Manager for this app. Obviously any app requires at least 1 thread, but in this case, what are the other 3 threads? I'd like to have a better understanding of what threads any VCL forms application runs by default. I thought possibly it had to be the fact that I was running in debug mode from RAD Studio, so I launched the EXE its self, and it also had 4 threads running. I also tried compiling under "release" config (thus disabling compiling debug info) and there are still 4 threads.
To determine the source of the threads, you can inspect the start address of the threads using a tool like process explorer or process hacker.
In this case for example you can see
On my computer all the other threads than the main thread are created because the application's window registered to receive session change notifications with Wtsapi32.WTSRegisterSessionNotification API. You can see the implementation inside Vcl.Forms -> TApplication.CreateHandle procedure. It must have to do with how the application work/looks when you logged through Terminal Services/Remote Desktop. Some other threads could possible exist because some other program/s loaded code into your executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With