🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

This source not work

#12867
From: Marcello Scala
Date: Tue, 11 Nov 2003 21:45
54 lines
2613 bytes
Hi All.

Why C++ Builder, not compile this source? (i found it on the C++ Builder 6
Help)


void __fastcall TForm1::Button1Click(TObject *Sender)

{
  const AnsiString InfoStr[10] = {"CompanyName", "FileDescription",
"FileVersion", "InternalName", "LegalCopyright", "LegalTradeMarks",
"OriginalFileName", "ProductName", "ProductVersion", "Comments"};
  char *ExeName = Application->ExeName.c_str();
  DWORD n = GetFileVersionInfoSize(ExeName, n);
  if (n > 0)
  {
    char *pBuf = (char *) malloc(n);
    AnsiString temp = "VersionInfoSize = ";
    Memo1->Lines->Add(temp + IntToStr(n));

    GetFileVersionInfo(ExeName, 0, n, pBuf);
    for (i = 0; i < 10; i++)
    {
      char *pValue;
      DWORD Len;
      temp = "StringFileInfo\\040904E4\\";
      temp = temp + InfoStr[i];
      if (VerQueryValue(pBuf, temp.c_str(), pValue, Len)
        Memo1->Lines->Add(InfoStr[i] + " = " + pValue);
    }
    free(pBuf);
  }
  else
    Memo1->Lines->Add("No version information found");
}

This are the error messages:

[C++ Error] Unit1.cpp(22): E2034 Cannot convert 'unsigned long' to 'unsigned
long *'
[C++ Error] Unit1.cpp(22): E2342 Type mismatch in parameter 'lpdwHandle'
(wanted 'unsigned long *', got 'unsigned long')
[C++ Error] Unit1.cpp(30): E2451 Undefined symbol 'i'
[C++ Error] Unit1.cpp(36): E2034 Cannot convert 'char *' to 'void * *'
[C++ Error] Unit1.cpp(36): E2342 Type mismatch in parameter 'lplpBuffer'
(wanted 'void * *', got 'char *')
[C++ Error] Unit1.cpp(36): E2034 Cannot convert 'unsigned long' to 'unsigned
int *'
[C++ Error] Unit1.cpp(36): E2342 Type mismatch in parameter 'puLen' (wanted
'unsigned int *', got 'unsigned long')
[C++ Error] Unit1.cpp(37): E2377 If statement missing )


Thanks
Technical Details
Message-ID: <3fb15869@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a4abdff0e2202e6c,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-11 14:09:50 PST
From: "Marcello Scala" <mscala@email.it>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: This source not work
Date: Tue, 11 Nov 2003 22:45:17 +0100
Lines: 56
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: 80.180.222.176
Message-ID: <3fb15869@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1068587113 80.180.222.176 (11 Nov 2003 13:45:13 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail