Article View: borland.public.cppbuilder.internet.socket
Article #4297Re: Declaring Thread Variable
From: John Borchers
Date: Thu, 03 Mar 2005 16:14
Date: Thu, 03 Mar 2005 16:14
34 lines
2019 bytes
2019 bytes
Couple things are wrong here:
> TTimer *timer;
1) This is local to the constructor only. You need to declare this in the
class declaration.
2) Are you calling MyThreadClass() with CreateSuspended false?
John
"mehmed sipahi" <furkan.atli@mobinex.com.tr> wrote in message
news:422734e0$1@newsgroups.borland.com...
> How I can create variable in a thread for access other functions.I mean;
>
> _fastcall MyThreadClass::MyThreadClass(bool CreateSuspended)
> : TThread(CreateSuspended)
> {
> //Declare timer Object
> TTimer *timer;
> timer=new TTimer(MainForm);
> }
> //---------------------------------------------------------------------------
> void __fastcall MyThreadClass::Execute()
> {
> timer->Enabled=false;
> }
>
>
> When I compile Cmpiler dosent give error.But when I run the program it
> comes "timer->Enabled=false" didn't work.BEcause timer is NULL..but
> why??how should i declare the timer object??
>
> Thanks
>
Technical Details
Message-ID:
<422737e8$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.esat.net!zen.net.uk!dedekind.zen.co.uk!newsfeeder.wxs.nl!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<422734e0$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1d5055ad12bdddd7 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "John Borchers" <jborchers@notmail.com> From: "John Borchers" <jborchers@notmail.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <422734e0$1@newsgroups.borland.com> Subject: Re: Declaring Thread Variable Date: Thu, 3 Mar 2005 11:14:33 -0500 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 63.116.149.114 Message-ID: <422737e8$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109866472 63.116.149.114 (3 Mar 2005 08:14:32 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.esat.net!zen.net.uk!dedekind.zen.co.uk!newsfeeder.wxs.nl!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail