(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:
var i, j: Integer;
Resource: IOTAProjectResource;
ModuleInfo: IOTAModuleInfo;
Module: IOTAModule;
Editor: IOTAEditor;
Resource := nil;
for i := 0 to Project.GetModuleCount - 1 do
begin
ModuleInfo := Project.GetModule(i);
try
Module := ModuleInfo.OpenModule; // can raise exception
for j := 0 to Module.ModuleFileCount - 1 do
begin
Editor := Module.ModuleFileEditors[j];
if Supports(Editor, IOTAProjectResource, Resource) then
Break;
end;
except
end;
if Assigned(Resource) then Break;
end;
if not Assigned(Resource) then
MessageBox(0, 'Not found!!!', 'Info', 0);
But in any case I always have Not found!!! message.