Solved

Another thread

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

12 Experts available now in Live!

Get 1:1 Help Now