Solved

Another thread

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

778 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