🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Minimal Example Code

#9025
From: Michael Lueck
Date: Tue, 17 Aug 2004 23:15
36 lines
1934 bytes
#include <iostream.h>
#include <windows.h>

int main(void)
{
      HMODULE Dll = GetModuleHandle("SHELL32.DLL");

      TCHAR szBuf[80];
      LPVOID lpMsgBuf;
      DWORD dw = GetLastError();

      FormatMessage(
          FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_SYSTEM,
          NULL,
          dw,
          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
          (LPTSTR) &lpMsgBuf,
          0, NULL );

      wsprintf(szBuf,
          "%s failed with error %d: %s",
          "Test", dw, lpMsgBuf);

      cout << szBuf;

      LocalFree(lpMsgBuf);

      return 0;
};

-- 
Michael Lueck
Lueck Data Systems

Remove the upper case letters NOSPAM to contact me directly.
Technical Details
Message-ID: <41229154$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <41228167$1@newsgroups.borland.com> <412289f4$1@newsgroups.borland.com> <41228d3b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8d61921d2e5eb0c4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 17 Aug 2004 19:15:15 -0400
From: Michael Lueck <NmlueckO@SlueckPdataAsystemsM.com>
Reply-To:  NmlueckO@SlueckPdataAsystemsM.com
Organization: Lueck Data Systems
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Minimal Example Code
References: <41228167$1@newsgroups.borland.com> <412289f4$1@newsgroups.borland.com> <41228d3b$1@newsgroups.borland.com>
In-Reply-To: <41228d3b$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.247.116.250
Message-ID: <41229154$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1092784468 24.247.116.250 (17 Aug 2004 16:14:28 -0700)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail