How do I create a UserInterface thread in Delphi?

Is it possible to make one using TThread object ?

I tried to create a form in Execute function of Thread but it doesn't return from the constructor. Please help me out...
rjaganAsked:
Who is Participating?
 
bcrotazConnect With a Mentor Commented:
I think you'll find you can't.
The VCL is not thread-safe.  Therefore you can't create a form in a thread, because it would call methods on the Application variable, which would be accessed from other threads too.

The best way out of this is to leave your user interface in the main VCL thread, and do all your intensive processing in other threads.  Then to display results from a thread, use the TThread.Synchronize(MyMethod) method.  There's some good help on this method.

Bryan
0
 
MadshiCommented:
Bryan is right. I really HATE it that the VCL is not thread safe...  :-(
0
 
rjaganAuthor Commented:
Thanks a lot for ur consideration
0
 
rjaganAuthor Commented:
Thanks a lot for ur consideration
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.