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 retrieve version info of system DL 's 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
20-Oct-02
Category
Files Operation
Language
Delphi 2.x
Views
136
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Is there a way to read the Language ID of a file first, and then use it to 
construct the LocaleString?

Answer:
1   
2   function GetFileTranslation(const Filename: string; FullName: Boolean = False):
3     string;
4   var
5     VerInfSize, Sz: Cardinal;
6     LangID: Pointer;
7     VerInfo: Pointer;
8     Buf: array[0..255] of char;
9   begin
10    Result := '';
11    if FileExists(Filename) then
12    begin
13      VerInfSize := GetFileVersionInfoSize(PCHAR(Filename), Sz);
14      if VerInfSize > 0 then
15      begin
16        VerInfo := AllocMem(VerInfSize);
17        try
18          GetFileVersionInfo(PCHAR(Filename), 0, VerInfSize, VerInfo);
19          VerQueryValue(VerInfo, '\VarFileInfo\Translation', LangID, Sz);
20          if LangID < > nil then
21            case Ord(FullName) of
22              0:
23                Result := IntToHex(MakeLong(HiWord(Longint(LangID^)),
24                  LoWord(Longint(LangID^))), 8);
25              1:
26                if VerLanguageName(DWORD(LangID^), Buf, SizeOf(Buf)) > 0 then
27                  Result := Buf;
28            end;
29        finally
30          FreeMem(VerInfo);
31        end;
32      end;
33    end;
34  end;


Pass False as the second parameter to construct this string. Pass True to get the language name.

			
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