Solved

Another thread

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 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