home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
prezent
/
cb
/
data.z
/
EXPTDEMO.DPR
< prev
next >
Wrap
Text File
|
1997-01-16
|
5KB
|
242 lines
library Exptdemo;
uses
ShareMem,
Forms,
Windows,
ExptIntf,
ToolIntf,
VirtIntf,
SysUtils,
Dlg in 'DLG.PAS' {DlgExpert},
Exconst in 'EXCONST.PAS',
App in 'APP.PAS' {AppExpert};
{$R EXPTBMPS.RES}
{$R STRINGS.RES}
type
TDialogExpert = class(TIExpert)
function GetName: string; override;
function GetComment: string; override;
function GetGlyph: HICON; override;
function GetStyle: TExpertStyle; override;
function GetState: TExpertState; override;
function GetIDString: string; override;
function GetAuthor: string; override;
function GetPage: string; override;
procedure Execute; override;
end;
TApplicationExpert = class(TIExpert)
function GetName: string; override;
function GetComment: string; override;
function GetGlyph: HICON; override;
function GetStyle: TExpertStyle; override;
function GetState: TExpertState; override;
function GetIDString: string; override;
function GetAuthor: string; override;
function GetPage: string; override;
procedure Execute; override;
end;
procedure HandleException;
begin
ToolServices.RaiseException(ReleaseException);
end;
{ TDialogExpert }
function TDialogExpert.GetName: string;
begin
try
Result := LoadStr(sDlgExpertName);
except
HandleException;
end;
end;
function TDialogExpert.GetComment: string;
begin
try
Result := LoadStr(sDlgExpertDesc);
except
HandleException;
end;
end;
function TDialogExpert.GetGlyph: HICON;
begin
try
Result := LoadIcon(HInstance, 'DLGEXPT');
except
HandleException;
end;
end;
function TDialogExpert.GetStyle: TExpertStyle;
begin
try
Result := esForm;
except
HandleException;
end;
end;
function TDialogExpert.GetState: TExpertState;
begin
try
Result := [esEnabled];
except
HandleException;
end;
end;
function TDialogExpert.GetIDString: string;
begin
try
Result := 'Borland.DlgExpertDemo';
except
HandleException;
end;
end;
function TDialogExpert.GetAuthor: string;
begin
try
Result := 'Borland';
except
HandleException;
end;
end;
function TDialogExpert.GetPage: string;
begin
try
Result := LoadStr(sDialogsPage);
except
HandleException;
end;
end;
procedure TDialogExpert.Execute;
begin
try
DialogExpert(ToolServices);
except
HandleException;
end;
end;
{ TApplicationExpert }
function TApplicationExpert.GetName: string;
begin
try
Result := LoadStr(sAppExpertName);
except
HandleException;
end;
end;
function TApplicationExpert.GetComment: string;
begin
try
Result := LoadStr(sAppExpertDesc);
except
HandleException;
end;
end;
function TApplicationExpert.GetGlyph: HICON;
begin
try
Result := LoadIcon(HInstance, 'APPEXPT');
except
HandleException;
end;
end;
function TApplicationExpert.GetStyle: TExpertStyle;
begin
try
Result := esProject;
except
HandleException;
end;
end;
function TApplicationExpert.GetState: TExpertState;
begin
try
Result := [esEnabled];
except
HandleException;
end;
end;
function TApplicationExpert.GetIDString: string;
begin
try
Result := 'Borland.AppExpertDemo';
except
HandleException;
end;
end;
function TApplicationExpert.GetAuthor: string;
begin
try
Result := 'Borland';
except
HandleException;
end;
end;
function TApplicationExpert.GetPage: string;
begin
try
Result := LoadStr(sProjectsPage);
except
HandleException;
end;
end;
procedure TApplicationExpert.Execute;
begin
try
ApplicationExpert(ToolServices);
except
HandleException;
end;
end;
procedure DoneExpert; export;
begin
{ Put any general destruction code here. Note that the Delphi IDE
will destroy any experts which have been registered. }
end;
function InitExpert(ToolServices: TIToolServices;
RegisterProc: TExpertRegisterProc;
var Terminate: TExpertTerminateProc): Boolean; export; stdcall;
begin
{ make sure we're the first and only instance }
Result := ExptIntf.ToolServices = nil;
if not Result then Exit;
ExptIntf.ToolServices := ToolServices;
if ToolServices <> nil then
Application.Handle := ToolServices.GetParentHandle;
Terminate := DoneExpert;
{ register the experts }
RegisterProc(TDialogExpert.Create);
RegisterProc(TApplicationExpert.Create);
end;
exports
InitExpert name ExpertEntryPoint resident;
begin
end.