dllexper.pas

来自「Delphi高级开发指南是开发程序的好帮手」· PAS 代码 · 共 114 行

PAS
114
字号
unit DLLExper;

interface

uses
  ShareMem, Windows, ExptIntf, ToolIntf, FileCtrl, SysUtils;

type
  // standard expert
  TPrjInfoExpert = class (TIExpert)
  public
    function GetStyle: TExpertStyle; override;
    function GetName: string; override;
    function GetAuthor: string; override;
    function GetComment: string; override;
    function GetPage: string; override;
    function GetGlyph: HICON; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetMenuText: string; override;
    procedure Execute; override;
  end;

function InitExpert(ToolServices: TIToolServices;
  RegisterProc: TExpertRegisterProc;
  var Terminate: TExpertTerminateProc): Boolean; stdcall;

implementation

uses
  Forms, VirtIntf, PrjForm, AddInExp;

// *****************************
// standard expert: project info
// *****************************

function TPrjInfoExpert.GetStyle: TExpertStyle;
begin
  Result := esStandard;
end;

function TPrjInfoExpert.GetName: string;
begin
  Result := 'Project Information Wizard';
end;

function TPrjInfoExpert.GetAuthor: string;
begin
  Result := 'Marco and Tim';
end;

function TPrjInfoExpert.GetComment: string;
begin
  Result := '';
end;

function TPrjInfoExpert.GetPage: string;
begin
  Result := '';
end;

function TPrjInfoExpert.GetGlyph: HICON;
begin
  Result := 0;
end;

function TPrjInfoExpert.GetState: TExpertState;
begin
  // conditional code
  if ToolServices.GetProjectName <> '' then
    Result := [esEnabled]
  else
    Result := [];
end;

function TPrjInfoExpert.GetIDString: string;
begin
  Result := 'DDHandbook.PrjInfoWizard';
end;

function TPrjInfoExpert.GetMenuText: string;
begin
  Result := 'Project &Info Wizard...';
end;

procedure TPrjInfoExpert.Execute;
begin
  try
    PrjInfoForm := TPrjInfoForm.Create (Application);
    PrjInfoForm.UpdateTree;
    PrjInfoForm.ShowModal;
    PrjInfoForm.Free;
  except
    ToolServices.RaiseException(ReleaseException);
  end;
end;

function InitExpert (ToolServices: TIToolServices;
  RegisterProc: TExpertRegisterProc;
  var Terminate: TExpertTerminateProc): Boolean;
begin
  Result := True;
  try
    ExptIntf.ToolServices := ToolServices;
    Application.Handle := ToolServices.GetParentHandle;
    RegisterProc (TPrjInfoExpert.Create);
    RegisterProc (TReloadExpert.Create);
  except
    ToolServices.RaiseException(ReleaseException);
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?