Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Configure Component Palette II

Posted on 2002-07-23
4
Medium Priority
?
337 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

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

604 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