Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program TStudent;
- {$mode objfpc}{$H+}
- uses
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- {$ENDIF}{$ENDIF}
- Classes, SysUtils, CustApp, Unit1
- { you can add units after this };
- type
- { Student }
- Student = class(TCustomApplication)
- protected
- procedure DoRun; override;
- public
- constructor Create(TheOwner: TComponent); override;
- destructor Destroy; override;
- procedure WriteHelp; virtual;
- end;
- { Student }
- procedure Student.DoRun;
- var
- ErrorMsg: String;
- begin
- // quick check parameters
- ErrorMsg:=CheckOptions('h','help');
- if ErrorMsg<>'' then begin
- ShowException(Exception.Create(ErrorMsg));
- Terminate;
- Exit;
- end;
- // parse parameters
- if HasOption('h','help') then begin
- WriteHelp;
- Terminate;
- Exit;
- end;
- { add your program here }
- // stop program loop
- Terminate;
- end;
- constructor Student.Create(TheOwner: TComponent);
- begin
- inherited Create(TheOwner);
- StopOnException:=True;
- end;
- destructor Student.Destroy;
- begin
- inherited Destroy;
- end;
- procedure Student.WriteHelp;
- begin
- { add your help code here }
- writeln('Usage: ',ExeName,' -h');
- end;
- var
- Application: Student;
- begin
- Application:=Student.Create(nil);
- Application.Title:='Student';
- Application.Run;
- Application.Free;
- end.
Advertisement
Add Comment
Please, Sign In to add comment