🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13768

Re: TThread

#13768
From: Andy
Date: Fri, 12 Sep 2003 16:05
44 lines
1907 bytes
//Start Thread Button

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   StopNow = false;
   TthreadTest *TestItThread = new TthreadTest(false); // create and run the thread
}


///Stop Button

void __fastcall TForm1::StopCodeClick(TObject *Sender)
{
  StopNow = true;
}


///////////////Thread Code

__fastcall TthreadTest::TthreadTest(bool CreateSuspended)
  : TThread(CreateSuspended)
{
 Priority = tpNormal;
}
//---------------------------------------------------------------------------
void __fastcall TthreadTest::Execute()
{
  FreeOnTerminate = true;
  Synchronize(ThreadFunc);
}
//---------------------------------------------------------------------------


void __fastcall TthreadTest::ThreadFunc()
{
  HDC DC = GetDC(Form1->Handle);
  for (int i = 0; ((i<=300000) && (!Form1->StopNow));i++ ) {
    String S = i;
    TextOut(DC, 10, 10, S.c_str(), S.Length());
  }
  ReleaseDC(Form1->Handle, DC);
  
}
Technical Details
Message-ID: <3f61eebb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f60e4dc$1@newsgroups.borland.com> <3f6114aa$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,b3bd84980f619f6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-12 09:09:31 PST
From: "Andy" <andyholcomb@comcast.net>
Sender: "Andy" <andyholcomb@comcast.net>
Reply-To: "Andy" <andyholcomb@comcast.net>
Subject: Re: TThread
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 66.12.8.230 66.12.8.230    
References: <3f60e4dc$1@newsgroups.borland.com> <3f6114aa$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f61eebb$1@newsgroups.borland.com>
Date: 12 Sep 2003 09:05:15 -0700
X-Trace: newsgroups.borland.com 1063382715 207.105.83.65 (12 Sep 2003 09:05:15 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail