home *** CD-ROM | disk | FTP | other *** search
- library Exptdemo;
-
- uses Forms,
- WinTypes,
- ExptIntf,
- ToolIntf,
- VirtIntf,
- SysUtils,
- WinProcs,
- 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: HBITMAP; override;
- function GetStyle: TExpertStyle; override;
- function GetState: TExpertState; override;
- function GetIDString: string; override;
- procedure Execute; override;
- end;
-
- TApplicationExpert = class(TIExpert)
- function GetName: string; override;
- function GetComment: string; override;
- function GetGlyph: HBITMAP; override;
- function GetStyle: TExpertStyle; override;
- function GetState: TExpertState; override;
- function GetIDString: 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: HBITMAP;
- begin
- try
- Result := LoadBitmap(HInstance, 'DIALOGEXPT');
- 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;
-
- 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: HBITMAP;
- begin
- try
- Result := LoadBitmap(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;
-
- 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;
- 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;
-
- function FaultHandler(FaultID: Word; faultAddr: Pointer): TFaultResponse; export;
- begin
- DefaultExceptHandler(FaultId, faultAddr);
- end;
-
- exports
- InitExpert name ExpertEntryPoint resident,
- FaultHandler name FaultHandlerSignature resident;
-
- begin
- end.
-