🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

How to insert into buffer?

#16586
From: Jarkko Juntunen
Date: Thu, 08 May 2003 08:28
43 lines
1934 bytes
Hi!

I have next chunk of code (mostly from MSDN web-page):

error = WNetAddConnection2(&nr, cPass, cUser, NULL);
    if(error)
    {
      LPVOID lpMsgBuf;

      if (!FormatMessage(
          FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_SYSTEM |
          FORMAT_MESSAGE_IGNORE_INSERTS,
          NULL,
          GetLastError(),
          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
          (LPTSTR) &lpMsgBuf,
          0,
          NULL ))
      {
         // Handle the error.
         return;
      }

      // Process any inserts in lpMsgBuf.
      // ...

    	
      // Display the string.
      MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | 
MB_ICONINFORMATION );

      // Free the buffer.
      LocalFree( lpMsgBuf );
    }

And that works just fine. But I'd like to insert something into begining of 
my lpMsgBuffer. So the error message will be something like "Can't connect 
:" lpMsgBuf;

But I don't know how to do that. Any suggestions?

Thanks!
Technical Details
Message-ID: <Xns937574BE25A36dzeidzeisuolakaivosc@207.105.83.65>
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!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,cd3fe3461df5a031,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-08 01:43:57 PST
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: How to insert into buffer?
From: Jarkko Juntunen <dzeidzei@suolakaivos.com>
Organization: Suolakaivos
Message-ID: <Xns937574BE25A36dzeidzeisuolakaivosc@207.105.83.65>
User-Agent: Xnews/L5
NNTP-Posting-Host: 192.107.203.102
Date: 8 May 2003 01:28:32 -0700
X-Trace: newsgroups.borland.com 1052382512 192.107.203.102 (8 May 2003 01:28:32 -0700)
Lines: 43
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!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail