Solved

Another thread

Posted on 1998-01-09
3
138 Views
Last Modified: 2010-04-04
I'm trying to make another thread in delpi 3.

I call in my main form's oncreate:

SecondThread := TThread.Create(false);

When the user presses a certain button I call:

SecondThread.Resume;

But the entire application just disappears after the last statement.  I think I'm doing something wrong when inheriting TThread's create method, can someone give me a working example of a thread unit?
0
Comment
Question by:Odie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:Matvey
ID: 1356086
Hi, I don't remember if the example exists in D3, but I can send you the D2 example.
The example shows three sorting methods at once to compare the speed, of cource it uses threads.

Post your email if you don't find it in D3.
( if you need mine it's bosism@netvision.net.il )

Matvey
0
 

Accepted Solution

by:
michael2010898 earned 50 total points
ID: 1356087
You can't use the tthread direcly
you must override it's excecute procedure.
1.Declare secthread like this:
type
  secthread=class(tthread)
   protected
    procedure execute;override;
2. Declare second in var
var
  second:secthread;
3. Put the code you want to use in the execute procedure
and then create the thread.
  second:=secthread.create(true);
4. Use the thread.
  second.resume;
0
 
LVL 1

Author Comment

by:Odie
ID: 1356088
Of course (how stupid can I get?).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 78
Wincontrol not (correctly) drawn 15 47
migrate this code to work on android 1 27
Using MMsystem To change audio input 1 14
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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