Solved

How do I create a UserInterface thread in Delphi?

Posted on 1999-01-06
4
259 Views
Last Modified: 2010-04-04
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...
0
Comment
Question by:rjagan
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
bcrotaz earned 30 total points
ID: 1354838
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
 
LVL 20

Expert Comment

by:Madshi
ID: 1354839
Bryan is right. I really HATE it that the VCL is not thread safe...  :-(
0
 

Author Comment

by:rjagan
ID: 1354840
Thanks a lot for ur consideration
0
 

Author Comment

by:rjagan
ID: 1354841
Thanks a lot for ur consideration
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question