Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

List all components in current project

Posted on 2006-03-27
6
Medium Priority
?
180 Views
Last Modified: 2010-04-05
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.
0
Comment
Question by:Stuart_Johnson
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
Pierre Cornelius earned 200 total points
ID: 16308145
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
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 16308910
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
 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 16309627
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
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 16317386
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
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 16924485
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month13 days, 3 hours left to enroll

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question