注册Dev的帮助文件

Download the CHM files from…

Code:
 
https://www.devexpress.com/Support/Documentation/download.xml?platform=vcl-dev-docs#content

…and unpack the files anywhere. The code below registers all CHM files. Just create a small vcl application, drop a button and paste the code.

Code:
 
uses
  System.Win.Registry,
  System.IOUtils,
  System.Types;

function RegisterHelpFiles(const Path: string; const DeleteKey: Boolean): Integer;
const
  CHtmlHelpRoot = 'SOFTWAREEmbarcaderoBDS17.0HelpHtmlHelp1Files';
var
  Files: TStringDynArray;
  FileName: string;
  Reg: TRegistry;
  Name: string;
begin
  Files := TDirectory.GetFiles(Path, '*.chm');
  if (Length(Files) = 0) then
    Exit(0);

  Reg := TRegistry.Create();
  try
    Result := 0;
    Reg.RootKey := HKEY_CURRENT_USER;
    if (Reg.OpenKey(CHtmlHelpRoot, False)) then
    begin
      for FileName in Files do
      begin
        Name := Concat(TPath.GetFileNameWithoutExtension(FileName), ' Help');
        if (DeleteKey) then
        begin
          if (Reg.DeleteValue(Name)) then
            Inc(Result);
        end
        else
        begin
          Reg.WriteString(Name, FileName);
          Inc(Result);
        end;
      end;
    end;
  finally
    Reg.Free();
  end;
end;

procedure TMainForm.Button1Click(Sender: TObject);
var
  Path: string;
  DeleteKey: Boolean;
  Count: Integer;
begin
  Path := '[Insert the Path of the DevExpress Help Files]';

  DeleteKey := False;
  Count := RegisterHelpFiles(Path, DeleteKey);

  //Setting to unregister the CHM files
  //DeleteKey := True;
  //Count := RegisterHelpFiles(Path, DeleteKey);

  ShowMessage(Format('Entries changed: %d', [Count]));
end;

Replace the placeholder "[Insert the Path of the DevExpress Help Files]" with the path where the CHM files was unpacked. Compile and run the method "RegisterHelpFiles(…)". All CHM from the path will be registered. Please don't forget to restart Delphi, before you use the DevExpress Help Files.

This procedure should also work for Delphi XE8, but the Registry key must be adapted in this case.

https://www.board4allcz.eu/showthread.php?t=625889

原文地址:https://www.cnblogs.com/findumars/p/5356698.html