Article View: borland.public.cppbuilder.nativeapi
Article #16468Re: Sending Message over a network
From: Muhammad Momin Rashid
Date: Tue, 13 May 2003 23:26
Date: Tue, 13 May 2003 23:26
45 lines
2641 bytes
2641 bytes
Thanks, I'll try out your solution in a moment. I was secretly hoping that
there is a simpler way than all these allocations/deallocations going on, so
you basically solved two of my problems :o)
Just curious, which one would be more effecient speed-wise? Manually
allocating/deallocating as I have done ... or by using WideString as
outlined in your solution?
Regards,
Muhammad Momin Rashid
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3ec17714@newsgroups.borland.com...
>
> "Muhammad Momin Rashid" <momin@hotmail.com> wrote in message
> news:3ec1568a@newsgroups.borland.com...
>
> > lBufferSize = asTemp.WideCharBufSize() + 1;
> > wchar_t *wcSendTo = new wchar_t[lBufferSize];
> > wcSendTo = asTemp.WideChar(wcSendTo, lBufferSize);
> <snip>
>
> You could simply all of that code by utilizing the AnsiString and
WideString
> classes instead of doing all of that manual memory
allocating/deallocating:
>
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> StatusBar1->SimpleText = "Sending Message";
>
> WideString wSendTo = EditSendTo->Text;
> WideString wFromName = EditMessageFrom->Text;
> AnsiString asMsg = MemoMessage->Text;
>
> int iReturn = NetMessageBufferSend(wcSendTo, wcSendTo, wcFromName,
> asMsg.c_str(), asMsg.Length()+1);
> ...
> }
>
>
> Gambit
>
>
Technical Details
Message-ID:
<3ec17fb6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!arclight.uoregon.edu!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ec0f3fb@newsgroups.borland.com> <3ec11fe0$1@newsgroups.borland.com> <3ec1568a@newsgroups.borland.com> <3ec17714@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,372ba4ad7a699fb7 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-13 16:32:03 PST From: "Muhammad Momin Rashid" <momin@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ec0f3fb@newsgroups.borland.com> <3ec11fe0$1@newsgroups.borland.com> <3ec1568a@newsgroups.borland.com> <3ec17714@newsgroups.borland.com> Subject: Re: Sending Message over a network Date: Wed, 14 May 2003 04:26:51 +0500 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 202.163.125.218 Message-ID: <3ec17fb6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1052868534 202.163.125.218 (13 May 2003 16:28:54 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!arclight.uoregon.edu!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail