Article View: borland.public.cppbuilder.nativeapi
Article #288Re: Delphi threading by example article in C++ Builder 2007 format
From: Remy Lebeau (TeamB)
Date: Wed, 28 May 2008 23:04
Date: Wed, 28 May 2008 23:04
27 lines
1901 bytes
1901 bytes
"na" <na@na.com> wrote in message news:483dc218$1@newsgroups.borland.com...
> Would you mind inspecting the following to see if it looks ok?
You can do away with the wrapper class altogether, it is not needed:
void TForm1::OnMessage(TMessage &Message)
{
if( Message.WParam == TH_COMPUTER )
{
AnsiString *pWrkStation = (AnsiString*) Message.LParam;
lb_Computer->Caption = *pWrkStation;
delete pWrkStation;
}
}
AnsiString *pWrkStation = new AnsiString("Some Value");
if( !PostMessage(Form1->Handle, TH_MESSAGE, TH_COMPUTER, (LPARAM)
pWrkStation) )
delete pWrkStation;
Either way, though, just make sure your TForm is actually processing all
TH_MESSAGE messages, or you will leak your allocated objects/strings.
Gambit
Technical Details
Message-ID:
<483de513$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<483da620$1@newsgroups.borland.com> <483dbcbb$1@newsgroups.borland.com> <483dc218$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,dc2961ba4f932b22 X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <483da620$1@newsgroups.borland.com> <483dbcbb$1@newsgroups.borland.com> <483dc218$1@newsgroups.borland.com> Subject: Re: Delphi threading by example article in C++ Builder 2007 format Date: Wed, 28 May 2008 16:04:01 -0700 Lines: 29 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 NNTP-Posting-Host: 207.178.157.90 Message-ID: <483de513$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1212015891 207.178.157.90 (28 May 2008 16:04:51 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail