BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Resourcestrings of a package

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Peter Below (TeamB)
Guest





PostPosted: Thu Oct 02, 2003 7:41 pm    Post subject: Re: Resourcestrings of a package Reply with quote



In article <3f7c5b34 (AT) newsgroups (DOT) borland.com>, Maël Hörz wrote:
Quote:
Is there a way to list all resourcenames of a bpl file?

If you build an executable (EXE, DLL, package) with the "full map file"
checkbox on the project options linker page checked the build will produce a
file with all resourcestrings in the project. The extension escapes me at the
moment, but it has the same filename as the project, so should be easy to
find.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Valent Levente
Guest





PostPosted: Fri Oct 03, 2003 6:37 am    Post subject: Re: Resourcestrings of a package Reply with quote



I have an exe for it.
The key for it is the EnumResourceNames Winapi function, and loading these
packages as datafiles.
In the following example, I call the SearchStrings method of my form, for
all the packages. It uses EnumResourceNames which calls my EnumStringsProc
function as a callback.
The last thing is the EnumResourceLanguages, because every resource can have
multiple entries, with different languages.

function EnumLangsFunc(hModule: THandle; lpszType: PChar; lpszName: PChar;
wIDLanguage: word;
lParam: TdxTreeListNode): Boolean; stdcall;
begin
lParam.Values[frm_mpp21.lst_impc_langid.index] := wIDLanguage;
result := False;
end;

function EnumStringsProc(hModule: THandle; lpszType: PChar; lpszName: PChar;
lParam: TdxTreeListNode): Boolean; stdcall;
var
nParent,
nStr: TdxTreeListNode;
hg, hr: THandle;
c: array[0..9999] of char;
p: PChar;
i: integer;
ml_lang: boolean;
begin
hg := ULONG(lpszName);
Result := true;
if hg < $0000FFFF then
begin
{The Resource Name given by EnumResNameProc is the blockID. The string ID in
LoadString() is given by (block ID - 1) * 16 + the index of the string in
that block.}
nParent := lParam.AddChild;
nParent.Strings[frm_mpp21.lst_impNev.Index] := IntToStr(hg);
nParent.Values[frm_mpp21.lst_impc_langid.index] := 0;
nParent.Values[frm_mpp21.lst_impc_tipus.index] := 'ST';
nParent.ImageIndex := 1;

hg := (hg - 1) * 16;
ml_Lang := False;
for i := 0 to 15 do
begin
Fillchar(c, Sizeof(c), #0);
LoadString(hModule, hg + i, c, sizeof(c) - 1);
if c[0] <> #0 then
begin
nStr := nParent.AddChild;
nStr.Strings[frm_mpp21.lst_impNev.Index] := IntToStr(hg + i);
nStr.Strings[frm_mpp21.lst_impc_eredeti.Index] := c;
nStr.Values[frm_mpp21.lst_impc_tipus.index] := 'S';
nStr.ImageIndex := 2;
if not ml_lang then
begin
EnumResourceLanguages(hModule,
lpszType,
lpszName,
@EnumLangsFunc,
integer(nParent));
ml_lang := true;
end;
end;
end;
end;
end;

procedure Tfrm_mpp21.SearchStrings(n: TdxTreelistNode);
var
mc_file: string;
hMod: Cardinal;
begin
mc_file := n.Strings[lst_impTeljesNev.index];
hMod := LoadLibraryEx(PChar(mc_file), 0, LOAD_LIBRARY_AS_DATAFILE);
if hMod <> 0 then
begin
EnumResourceNames(hMod, RT_STRING, @EnumStringsProc, integer(n));
FreeLibrary(hMod);
end;
end;



--
Levente VALENT
[email]vlevi (AT) freemail (DOT) hu[/email]


Back to top
Peter Below (TeamB)
Guest





PostPosted: Sat Oct 04, 2003 12:22 pm    Post subject: Re: Resourcestrings of a package Reply with quote



In article <3f7dcba1 (AT) newsgroups (DOT) borland.com>, Maël Hörz wrote:
Quote:
I would like to list all resourcestring-names and find their corresponding
id.
Using a map file is not really what I want.
I would prefer not to need recompiling because this would take quite some
time for all available packages.
Also this would cause problems with Borlands bpls.
Is there a way to dump info abut a dcp-file with delphi-tools without
recompiling?

The data is there but the format it is exported in is undocumented, as far as
i know. I have never looked into this stuff and cannot help you with it,
sorry.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Frits.
Guest





PostPosted: Mon Oct 06, 2003 8:53 pm    Post subject: Re: Resourcestrings of a package Reply with quote

Mal H rz wrote:

Quote:
Is there a way to list all resourcenames of a bpl file?

have you looked at
http://www.wilsonc.demon.co.uk/d7resourceexplorer.htm
From Colin Wilson writer of Xananews my news reader.

--
Frits.

Posted with Xananews 1.15.7.2 on W2K(sp4)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.