🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Sending Message over a network

#16467
From: Remy Lebeau (TeamB)
Date: Tue, 13 May 2003 22:54
27 lines
1821 bytes
"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: <3ec17714@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ec0f3fb@newsgroups.borland.com> <3ec11fe0$1@newsgroups.borland.com> <3ec1568a@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 15:56:05 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ec0f3fb@newsgroups.borland.com> <3ec11fe0$1@newsgroups.borland.com> <3ec1568a@newsgroups.borland.com>
Subject: Re: Sending Message over a network
Date: Tue, 13 May 2003 15:54:09 -0700
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3ec17714@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052866324 207.175.226.26 (13 May 2003 15:52:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail