List all components in current project

Hi,

Can anyone recommend an app that will list all the components in a Delphi project (one we have source code for)?  We wish to build a manifest so we can work out which components we need to upgrade when moving to .NET.

Thanks very much

Stuart.
LVL 6
Stuart_JohnsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pierre CorneliusCommented:
This should do the trick:

procedure ListComps(ParentComp: TComponent; sl: TStrings);
var i: integer;
begin
  for i:= 0 to ParentComp.ComponentCount-1 do
  begin
    sl.Add(ParentComp.Components[i].ClassName+'='
           +PArentComp.Components[i].Name);
    if (ParentComp.Components[i].ComponentCount > 0)
      then ListComps(ParentComp.Components[i], sl);
  end;
end;

e.g. of use : ListComps(Application, SomeListbox.Items);


Note: I have used the name value pairs of a TStrings object to document results, but you can easily modify the procedure to suit your output needs.

Regards
Pierre
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stuart_JohnsonAuthor Commented:
Hi Pierre,

With this iterate through the WHOLE project and tell me what components I have?  Even on forms that are not currently in memory?

Thanks for the response,

Stuart
0
Pierre CorneliusCommented:
Yes, It will iterate the whole project but it will only show existing components (i.e. objects instantiated). If your source files contain a TSomeComponent class but there is no instance of it, it will not be included. If that is what you need, you will need to build a parser that will go through all your source code files (.pas files) and pick up all components that descends directly or indirectly from TComponent.
0
Stuart_JohnsonAuthor Commented:
Yeah, we also create components at runtime.

I know there is a program which will do this, I just can't for the life of me remember what it is called.

I'll have a look at trying to implement your suggestion and see if that is adequate.  It maybe as Im fairly sure the components that we create at runtime would have also been used at design time.

Cheers,

Stuart.
0
Stuart_JohnsonAuthor Commented:
Sorry about that.  In amongst everything else that's going on, I completely forgot about this question.

Thank you Pierre for your help.

Stuart
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

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.