Solved

Another thread

Posted on 1998-01-09
3
133 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Save pdf file to other location 3 79
Delphi XE10 Round Image 2 75
Convert MS Word document to a PDF file 9 60
Delphi and Access based Enumeration 9 44
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

937 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now