-
Notifications
You must be signed in to change notification settings - Fork 0
/
VinylScan.lpr
65 lines (56 loc) · 1.49 KB
/
VinylScan.lpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
program VinylScan;
{$mode objfpc}{$H+}
uses
tbbmalloc,
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main, scan2track, utils, powell, inputscan, scancorrelator,
{ you can add units after this }
SysUtils, LCLType, Controls;
{$R *.res}
type
{ TEvtHolder }
TEvtHolder = class
procedure AppException(Sender : TObject; E : Exception);
end;
procedure TEvtHolder.AppException(Sender: TObject; E: Exception);
var
I: Integer;
Frames: PPointer;
Report: string;
begin
Screen.Cursor := crDefault;
Report := 'Program exception! ' + LineEnding +
'Stacktrace:' + LineEnding + LineEnding;
if E <> nil then begin
Report := Report + 'Exception class: ' + E.ClassName + LineEnding +
'Message: ' + E.Message + LineEnding;
end;
Report := Report + BackTraceStrFunc(ExceptAddr);
Frames := ExceptFrames;
for I := 0 to ExceptFrameCount - 1 do
Report := Report + LineEnding + BackTraceStrFunc(Frames[I]);
WriteLn(Report);
TApplication(Sender).MessageBox(PChar(Report), PChar(Application.Title), MB_ICONERROR);
end;
var
EvtHolder: TEvtHolder;
begin
EvtHolder := TEvtHolder.Create;
try
RequireDerivedFormResource:=True;
Application.Title := 'GliGli''s VinylScan';
Application.Scaled := True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.OnException := @EvtHolder.AppException;
Application.Run;
finally
EvtHolder.Free;
end;
end.