📄 errore.pas
字号:
unit errore;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Printers;
type
Terrore_form = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Panel2: TPanel;
spiegazioni: TMemo;
Chiudi: TButton;
StampaBtn: TButton;
errore_Label: TMemo;
PrintDialog1: TPrintDialog;
procedure StampaBtnClick(Sender: TObject);
procedure ChiudiClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure GestisciErrore(Sender: TObject; E: Exception);
procedure SpiegaKey;
procedure SpiegaAccess;
procedure ScriviErrore(err,riga: string);
end;
var
errore_form: Terrore_form;
implementation
{$R *.DFM}
procedure Terrore_form.GestisciErrore(Sender: TObject; E: Exception) ;
Const
nomeFile : String = 'errbanco.txt' ;
Var
ErrFile : TextFile ;
riga : String ;
Componente : Tcomponent ;
begin
Assignfile(ErrFile,nomefile) ;
If FileExists(nomefile) then
Append(ErrFile)
else
Rewrite(ErrFile) ;
riga := '"' + DateTimeToStr(now) + '","' + e.message + '","' +
Sender.ClassName + '"' ;
if sender is tcomponent then
begin
Componente := Sender as Tcomponent ;
Repeat
Riga := riga + ',' + Componente.Name ;
Componente := Componente.Owner ;
until Componente = nil ;
end ;
WriteLn(ErrFile,Riga) ;
CloseFile(ErrFile) ;
Errore_form := Terrore_form.Create(nil) ;
ScriviErrore(e.message,Riga) ;
if e.message = 'Key violation' then
SpiegaKey ;
if pos('ACCESS',Uppercase(e.message)) > 0 then
SpiegaAccess ;
Errore_form.Show ;
end;
procedure Terrore_form.SpiegaAccess;
begin
Spiegazioni.Lines.Add('Istruzioni : ') ;
Spiegazioni.Lines.Add('Generalmente questo errore si verifica in due casi :') ;
Spiegazioni.Lines.Add('1. La memoria del sistema non
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -