3

i am working on a component for delphi 7 and for quick installation without having to touch the IDE i am making a simple installer according to this SO answer by Marjan Venema.

    procedure TForm1.Button1Click(Sender: TObject);
    var
      sDelphi7PackageName : string;
      sDelphi7Path,fileSource,fileDest : string;
      sDelphi7packBPL,sDelphi7PathMenuBPL  : string;
    begin
       sDelphi7Path:=ReadRegistryValues('\Software\Borland\Delphi\7.0',FALSE,'RootDir',1,TRUE);{<-- returns the 'C:\Program Files\Borland\Delphi7' }

      {#1. Install .bpl}
      sDelphi7BPL:=sDelphi7Path+'\Projects\Bpl\Pack.bpl';
      WriteValueToRegisTry('\Software\Borland\Delphi\7.0\Known   Packages',FALSE,sDelphi7BPL,'Delphi 7 compo Bpl File'); {<-- writes to the registry}

      fileSource:=ExtractFilePath(Application.ExeName)+'\Packages\comPack.bpl';
      fileDest:=sDelphi7BPL;
      CopyFile(PChar(fileSource), PChar(fileDest), False);
      end;

This works fine ![enter image description here][2] C:\Program Files\Borland\Delphi7\Projects\Bpl\Pack.bpl. but the component installed id hidden

can anyone tell me how to unhide the component on installation?

EDIT

may be useful:

1) i already have the bpl file of the component so i am copying directly to the delphi 7 directory C:\Program Files\Borland\Delphi7\Projects\Bpl and modifying the registry HKEY_CURRENT_USER\Software\Borland\Delphi\7.0\Known Packages.

2) the register procedure of the component

 implementation
 procedure Register;
  begin
      RegisterComponents('comp', [Tcomp]);
  end;
Community
  • 1
  • 1
PresleyDias
  • 3,657
  • 6
  • 36
  • 62
  • Can you please provide the code you've put in your `procedure Register` method inside of your package? – LaKraven May 07 '12 at 10:00
  • 1
    @LaKraven: I'm afraid in this case the Register procedure is not relevant. My understanding of the question is that the OP is attempting to install components by means of some direct registry manipulation. – menjaraz May 07 '12 at 10:24
  • @LaKraven `procedure Register` addded – PresleyDias May 07 '12 at 10:27
  • 1
    @menjaraz: nope the Register procedure is relevant. The windows registry is just to make the IDE aware of the bpl's to load. The register procedure is what the IDE executes after loading the bpl to put the components on a page of the palet. – Marjan Venema May 07 '12 at 11:21
  • @PresleyDias did you declare the Register procedure in the interface section as well? And with the correct capitalization? That is a capital R and the rest lowercase? This is the one place in which Delphi is (needs to be) case-sensitive, – Marjan Venema May 07 '12 at 11:23
  • @MarjanVenema : yes `procedure Register;` in the `interface` section – PresleyDias May 07 '12 at 11:28
  • In that case I am stumped. Should work. I do see that in your WriteValueToRegisTry statement, there are extra spaces between "Known" and "Packages", but maybe that's just from copy/pasting? – Marjan Venema May 07 '12 at 11:35
  • @MarjanVenema : [TOndrej's](http://stackoverflow.com/a/10481291/1051198) answer worked and thank you for your original answer also – PresleyDias May 07 '12 at 11:36
  • @Marjan Venema: I thought that it was only needed for the sake of creation of the entries on the registry when registering the components using the IDE and basta. Is that the reason for Classes.RegisterComponentsProc (Handler used within Classes.RegisterComponents procedure) making the *Register* procedure somewhat "polymorphic" ? – menjaraz May 07 '12 at 13:40
  • @menjaraz: Polymorphism doesn't come into it. RegisterComponentsProc is simply a variable that holds the address of a procedure with the same signature as RegisterComponents (without declaring an explicit type for it). I expect that this var will get its value set by the IDE before the Register procedures in the units of a package are called (if one exists for the unit). You could think of it as a call back provided by the IDE. – Marjan Venema May 07 '12 at 13:51
  • @Marjan Venema: You are right, polymorphism is for the OOP paradigma and it's actually a call back used by the IDE: I remember now of an article of Rudy Velthuis related to *compinst* where he attempted in vain to register a component from code by calling directely the Register procedure (BPL). Thank you for your input. – menjaraz May 07 '12 at 13:58

1 Answers1

8

In the registry, under HKEY_CURRENT_USER\Software\Borland\Delphi\7.0\Palette, find the entry named 'comp.Hidden' and edit it to remove the class name of your component (or delete the entry altogether).

PresleyDias
  • 3,657
  • 6
  • 36
  • 62
Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128