?
Solved

Configure Component Palette II

Posted on 2002-07-23
4
Medium Priority
?
326 Views
Last Modified: 2010-04-04
Hello,

This was my first question:
In Delphi 6 main menu I choose:
Component --> Configure Palette
Does anybody know how you can export this information
to a file or database?

But I'd like to do more:
Can I get more information about components? (like picture and package information)?

Or is there already a tool to do this?

Greetings,

Wim Baaijens
0
Comment
Question by:wimbaaijens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 400 total points
ID: 7172843
Hi, I've created a sample Delphi 6 wizard just for the fun. Add the following unit to a designtime-only package, compile and install the package. (You'll have to add designide.dcp and vcljpg.dcp to the requires clause in order to compile.)
After successful installation, a new menu item 'Package info...' should appear under 'Help' menu.
Selecting the menu will save component images to .jpg files and produce a .htm file showing the packages, components and component images. HTH, TOndrej

unit PkgInfo;

interface

uses
  Classes, SysUtils, ToolsAPI;

type
  TPackageInfoWizard = class(TNotifierObject, IOTAWizard, IOTAMenuWizard)
  private
    { IOTAWizard }
    procedure Execute;
    function GetIDString: string;
    function GetName: string;
    function GetState: TWizardState;
    { IOTAMenuWizard }
    function GetMenuText: string;
  end;

procedure Register;

implementation

uses
  Windows, Forms, Controls, Dialogs, Graphics, JPEG, ShellAPI;

procedure Register;
begin
  RegisterPackageWizard(TPackageInfoWizard.Create);
end;

{ TPackageInfoWizard private: IOTAWizard}

procedure TPackageInfoWizard.Execute;
var
  I, J: Integer;
  F: TextFile;
  PackageHandle: HMODULE;
  ComponentBitmap: TBitmap;
  ComponentJPEG: TJPEGImage;
  BitmapDir: string;
begin
  ForceCurrentDirectory := True;
  with TSaveDialog.Create(nil) do
    try
      DefaultExt := 'txt';
      Filter := 'HTML files (*.htm)|*.htm|All files (*.*)|*.*';
      FilterIndex := 0;
      Options := [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing];
      Title := 'Save Delphi package information';
      if Execute then
      begin
        Screen.Cursor := crHourglass;
        try
          BitmapDir := ChangeFileExt(FileName, '.');
          Delete(BitmapDir, Length(BitmapDir), 1);
          BitmapDir := BitmapDir + '_files';

          AssignFile(F, FileName);
          Rewrite(F);
          try
            Writeln(F, '<html>');
            Writeln(F, '<title>Delphi package information</title>');
            Writeln(F, '<body>');
            with BorlandIDEServices as IOTAPackageServices do
              for I := 0 to PackageCount - 1 do
                if ComponentCount[I] > 0 then
                begin
                  PackageHandle := GetModuleHandle(PChar(PackageNames[I] + '.bpl'));
                  Writeln(F, '<br><b>', PackageNames[I], '</b><br>');
                  for J := 0 to ComponentCount[I] - 1 do
                  begin
                    if PackageHandle <> 0 then
                    begin
                      ComponentBitmap := TBitmap.Create;
                      try
                        try
                          ComponentBitmap.LoadFromResourceName(PackageHandle, UpperCase(ComponentNames[I, J]));
                          ComponentJPEG := TJPEGImage.Create;
                          try
                            ComponentJPEG.Assign(ComponentBitmap);
                            ForceDirectories(BitmapDir);
                            ComponentJPEG.SaveToFile(IncludeTrailingPathDelimiter(BitmapDir) + ComponentNames[I, J] +
                              '.jpg');
                          finally
                            ComponentJPEG.Free;
                          end;
                        except
                          // suppress error when resource bitmap not found
                        end;
                        Writeln(F, '<img src=".\', IncludeTrailingPathDelimiter(ExtractFileName(BitmapDir)),
                          ComponentNames[I, J], '.jpg', '"> ', ComponentNames[I, J], '<br>');
                      finally
                        ComponentBitmap.Free;
                      end;
                    end;
                  end;
                end;
            Writeln(F, '</body>');
            Writeln(F, '</html>');
          finally
            CloseFile(F);
          end;
          ShellExecute(Application.Handle, 'open', PChar(FileName), nil, PChar(ExtractFilePath(FileName)),
            SW_SHOWNORMAL);
        finally
          Screen.Cursor := crDefault;
        end;
      end;
    finally
      Free;
    end;
end;

function TPackageInfoWizard.GetIDString: string;
begin
  Result := 'TOndrej.PackageInfoWizard';
end;

function TPackageInfoWizard.GetName: string;
begin
  Result := 'Package Info Wizard';
end;

function TPackageInfoWizard.GetState: TWizardState;
begin
  Result := [wsEnabled];
end;

{ TPackageInfoWizard private: IOTAMenuWizard }

function TPackageInfoWizard.GetMenuText: string;
begin
  Result := 'Package Info...';
end;

end.
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7173269
Now that is very cool :)
0
 

Author Comment

by:wimbaaijens
ID: 7173828
Thanks!
It's a very good sample!
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 7173834
I'm glad you liked it :-)
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 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