📄 addinexp.pas
字号:
unit AddInExp;
interface
uses
ShareMem, Windows, ExptIntf, ToolIntf, FileCtrl, SysUtils;
type
// add-in expert
TReloadExpert = class (TIExpert)
public
constructor Create;
destructor Destroy; override;
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;
procedure ReloadClick (Sender: TIMenuItemIntf);
private
NewMenuItem: TIMenuItemIntf;
end;
implementation
uses
VirtIntf;
constructor TReloadExpert.Create;
var
MainMenu: TIMainMenuIntf;
MainMenuItems, FileMenu: TIMenuItemIntf;
begin
inherited Create;
MainMenu := nil;
MainMenuItems := nil;
FileMenu := nil;
NewMenuItem := nil;
try try
MainMenu := ToolServices.GetMainMenu;
MainMenuItems := MainMenu.GetMenuItems;
FileMenu := MainMenuItems.GetItem (0);
NewMenuItem := FileMenu.InsertItem (7, 'Reloa&d',
'ReloadExpertItem', '', 0, 0, 0,
[mfVisible, mfEnabled], ReloadClick)
finally
FileMenu.Free;
MainMenuItems.Free;
MainMenu.Free;
end;
except
ToolServices.RaiseException(ReleaseException);
end;
{ // confirmation message...
MessageBox (ToolServices.GetParentHandle,
'File/Reload menu item added',
'Reload Expert', mb_OK);}
end;
destructor TReloadExpert.Destroy;
begin
{ MessageBeep (0);
MessageBox (ToolServices.GetParentHandle,
'destructor',
'Reload Wizard', mb_OK);}
NewMenuItem.Free;
inherited Destroy;
end;
procedure TReloadExpert.ReloadClick (Sender: TIMenuItemIntf);
begin
try
if MessageBox (ToolServices.GetParentHandle,
'Are you sure you want to reload the file?',
'Confirmation', mb_YesNo) = idYes then
ToolServices.ReloadFile (
ToolServices.GetCurrentFile);
except
ToolServices.RaiseException(ReleaseException);
end;
end;
function TReloadExpert.GetStyle: TExpertStyle;
begin
Result := esAddIn;
end;
function TReloadExpert.GetName: String;
begin
Result := 'Reload Wizard'
end;
function TReloadExpert.GetAuthor: string;
begin
Result := 'Marco and Tim';
end;
function TReloadExpert.GetComment: String;
begin
Result := '';
end;
function TReloadExpert.GetPage: string;
begin
Result := '';
end;
function TReloadExpert.GetGlyph: HICON;
begin
Result := 0;
end;
function TReloadExpert.GetState: TExpertState;
begin
Result := [];
end;
function TReloadExpert.GetIDString: String;
begin
// must be unique
Result := 'DDHandbook.ReloadWizard'
end;
function TReloadExpert.GetMenuText: String;
begin
Result := ''
end;
procedure TReloadExpert.Execute;
begin
// nothing to do
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -