Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to extract and display version info from files Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
15-Sep-02
Category
Shell API
Language
Delphi 2.x
Views
82
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert 

Extract and display version info from files

Answer:

This routine shows how to retrieve version information from the Windows resources 
and displays it with a ShowMessage box:
1   
2   procedure TForm1.GetVersionInfo;
3   const
4     n_Info = 10;
5     InfoStr: array[1..n_Info] of string =
6     ('CompanyName', 'FileDescription', 'FileVersion', 'InternalName',
7       'LegalCopyright', 'LegalTradeMarks', 'OriginalFilename',
8       'ProductName', 'ProductVersion', 'Comments');
9   var
10    Info: string;
11    BuffSize,
12      Len, i: Integer;
13    Buff: PChar;
14    Value: PChar;
15  begin
16    Info := Application.ExeName;
17    BuffSize := GetFileVersionInfoSize(PChar(Info), BuffSize);
18    if BuffSize > 0 then
19    begin
20      Buff := AllocMem(BuffSize);
21      Memo1.Lines.Add('FileVersionInfoSize=' + IntToStr(BuffSize));
22      GetFileVersionInfo(PChar(Info), 0, BuffSize, Buff);
23      Info := Info + ':';
24      for i := 1 to n_Info do
25        if VerQueryValue(Buff, PChar('StringFileInfo\040904E4\' +
26          InfoStr[i]), Pointer(Value), Len) then
27          Info := Info + #13 + InfoStr[i] + '=' + Value;
28      FreeMem(Buff, BuffSize);
29      ShowMessage(Info);
30    end
31    else
32      ShowMessage('No FileVersionInfo found');
33  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC