determine number of resources in a file


i know , in delphi 7, i can do this to extract one resource named "ResourceName" from currently running app,

var
  rStream := TResourceStream;

begin
  rStream := TResourceStream.Create(0, 'ResourceName', RT_RCDATA);
  rStream.SaveToFile('filepath');
end;


but how to extract all resource files within a resource type,, how to determine their number, names or if one exists or not ??

AgentAmineAsked:
Who is Participating?
 
Emmanuel PASQUIERFreelance Project ManagerCommented:
check this :
http://msdn.microsoft.com/en-us/library/ms648037%28VS.85%29.aspx

and here is an example to use it :
http://www.swissdelphicenter.ch/torry/showcode.php?id=1710

be aware that in this example, the function that adds all resources found to the list adds a space before all names, and for the resources that are not named but only have an ID, they are marked with a # and ID number

I striped the spaces in the function below :
function enumResNamesProc(module: HMODULE; restype, resname: PChar;
  list: TStrings): Integer; stdcall;
begin
  if HiWord(Cardinal(resname)) <> 0 then
    list.Add(resname)
  else
    list.Add(Format('#%d', [loword(Cardinal(resname))]));
  Result := 1;
end;

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.