I was doing some legwork for this question, specifically, for the following sentence:
I even could not get this interface from IOTAProject.
By again I mean well-known defect present in Delphi 2005 and 2006 outlined by Erik Berry. Please visit linked QC entry for complete testcase.
Enough words, here is the my code:
procedure TResDumpWizard.Execute;
var
Project: IOTAProject;
Resource: IOTAProjectResource;
I: Integer;
Entry: IOTAResourceEntry;
begin
Project := (BorlandIDEServices as IOTAModuleServices).GetActiveProject;
Assert(Assigned(Project), 'No active project');
Resource := nil;
for I := 0 to Project.ModuleFileCount - 1 do
begin
if Supports(Project.ModuleFileEditors[I], IOTAProjectResource, Resource) then
Break;
end;
Assert(Assigned(Resource), 'No resources in project'); // (!!!) always fails
for I := 0 to Resource.GetEntryCount - 1 do
begin
Entry := Resource.GetEntry(I);
(BorlandIDEServices as IOTAMessageServices).AddTitleMessage(DisplayName(Entry.GetResourceName));
end;
end;
Looping over project's module file editors never finds any resources even if project have additional resources
- added via Resources and Images dialog
- using
{$RESOURCE binary.res}
directive usingwhich no longer works{$R filename.res filename.rc}
syntax
(I have low reputation so cannot add a comment)
Project.ModuleFileCount always returns 1 and Project.ModuleFileEditors[0].FileName returns ProjectName.dpr
In XE3 I tested it is possible to enumerate all modules of project with the following code:
But in any case I always have Not found!!! message.