⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intexpt.pas

📁 《Delphi开发人员指南》配书原码
💻 PAS
字号:
unit intexpt;
interface

uses
  ShareMem, dialogs,SysUtils, Windows, VirtIntf, ExptIntf, ToolIntf;

procedure HandleException;

type
  TGrepspert = class(TIExpert)
    function GetName: string; override;
    function GetStyle: TExpertStyle; override;
    function GetState: TExpertState; override;
    function GetIDString: string; override;
    function GetMenuText: string; override;
    procedure Execute; override;
  end;

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

uses Forms, Controls, Main;


procedure HandleException;
{ Raise exception within the context of the IDE }
begin
  ToolServices.RaiseException(ReleaseException);
end;

function TGrepspert.GetName: string;
{ Return name of expert }
begin
  Result := 'Grepspert';
end;

function TGrepspert.GetStyle: TExpertStyle;
{ Return the style of the expert.  This one is standard. }
begin
  Result := esStandard;
end;

function TGrepspert.GetState: TExpertState;
{ This expert is always enabled on the menu }
begin
  Result := [esEnabled];
end;

function TGrepspert.GetIDString: String;
{ Return the unique Vendor.Product name of expert }
begin
  Result := 'DDG.Grepspert';
end;

function TGrepspert.GetMenuText: string;
{ Return text for Help menu }
begin
  Result := 'Grepspert';
end;

procedure TGrepspert.Execute;
{ Called when expert name is selected from Help menu of IDE. }
{ This function invokes the expert }
begin
  try
    if not Assigned(GrepForm) then begin         // if not created...
      GrepForm := TGrepForm.Create(Application); // create it
      GrepForm.Show;                             // show it
    end
    else with GrepForm do begin                  // if created...
      if WindowState = wsMinimized then
        WindowState := wsNormal;                 // restore window
      SetFocus;                                  // show it
    end;
  except
    HandleException;
  end;
end;

function InitExpert(AToolServices: TIToolServices;
  RegisterProc: TExpertRegisterProc;
  var Terminate: TExpertTerminateProc): Boolean; stdcall;
begin
  Result := True;
  if ToolServices = nil then begin
    try
      ToolServices := AToolServices;
      Application.Handle := ToolServices.GetParentHandle;
      RegisterProc(TGrepspert.Create);
    except
      HandleException;
    end;
  end
  else
    Result := False;
end;

end.

⌨️ 快捷键说明

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