Thanks for reading my question!
Currently I'm writing the error handling code of my
application. I've added things that interest me such
as the time and date, error message, the error classname
etc etc. But what I also want to add is the applications
version number. The only thing I could find on this subject
is this piece of code in the helpfile:
Now this will get it for any and all files and probably
works like a charm, but I don't need all this junk and
frankly think there is probably a much simpler way
(although Application.VersionNumber was too much to ask for
hahaha). Does anyone have a better and simpler method of
getting this (because frankly I do not understand all this
buffering stuff, must be punishment for being self-taught)?
Thanks a lot!
BobbaFet ![[bobafett] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
Currently I'm writing the error handling code of my
application. I've added things that interest me such
as the time and date, error message, the error classname
etc etc. But what I also want to add is the applications
version number. The only thing I could find on this subject
is this piece of code in the helpfile:
Code:
procedure TForm1.Button1Click(Sender: TObject);
const
InfoNum = 10;
InfoStr: array[1..InfoNum] of string = ('CompanyName', 'FileDescription', 'FileVersion', 'InternalName', 'LegalCopyright', 'LegalTradeMarks', 'OriginalFileName', 'ProductName', 'ProductVersion', 'Comments');
var
S: string;
n, Len, i: DWORD;
Buf: PChar;
Value: PChar;
begin
S := Application.ExeName;
n := GetFileVersionInfoSize(PChar(S), n);
if n > 0 then
begin
Buf := AllocMem(n);
Memo1.Lines.Add('VersionInfoSize = ' + IntToStr(n));
GetFileVersionInfo(PChar(S), 0, n, Buf);
for i := 1 to InfoNum do
if VerQueryValue(Buf, PChar('StringFileInfo\040904E4\' + InfoStr[i]), Pointer(Value), Len) then
Memo1.Lines.Add(InfoStr[i] + ' = ' + Value);
FreeMem(Buf, n);
end
else
Memo1.Lines.Add('No version information found');
end;
Now this will get it for any and all files and probably
works like a charm, but I don't need all this junk and
frankly think there is probably a much simpler way
(although Application.VersionNumber was too much to ask for
hahaha). Does anyone have a better and simpler method of
getting this (because frankly I do not understand all this
buffering stuff, must be punishment for being self-taught)?
Thanks a lot!
![[bobafett] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
![[bobafett] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
Code:
if not Programming = 'Severe Migraine' then
ShowMessage('Eureka!');