Akaleaf

Untitled

Feb 13th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. program TStudent;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6. {$IFDEF UNIX}{$IFDEF UseCThreads}
  7. cthreads,
  8. {$ENDIF}{$ENDIF}
  9. Classes, SysUtils, CustApp, Unit1
  10. { you can add units after this };
  11.  
  12. type
  13.  
  14. { Student }
  15.  
  16. Student = class(TCustomApplication)
  17. protected
  18. procedure DoRun; override;
  19. public
  20. constructor Create(TheOwner: TComponent); override;
  21. destructor Destroy; override;
  22. procedure WriteHelp; virtual;
  23. end;
  24.  
  25. { Student }
  26.  
  27. procedure Student.DoRun;
  28. var
  29. ErrorMsg: String;
  30. begin
  31. // quick check parameters
  32. ErrorMsg:=CheckOptions('h','help');
  33. if ErrorMsg<>'' then begin
  34. ShowException(Exception.Create(ErrorMsg));
  35. Terminate;
  36. Exit;
  37. end;
  38.  
  39. // parse parameters
  40. if HasOption('h','help') then begin
  41. WriteHelp;
  42. Terminate;
  43. Exit;
  44. end;
  45.  
  46. { add your program here }
  47.  
  48. // stop program loop
  49. Terminate;
  50. end;
  51.  
  52. constructor Student.Create(TheOwner: TComponent);
  53. begin
  54. inherited Create(TheOwner);
  55. StopOnException:=True;
  56. end;
  57.  
  58. destructor Student.Destroy;
  59. begin
  60. inherited Destroy;
  61. end;
  62.  
  63. procedure Student.WriteHelp;
  64. begin
  65. { add your help code here }
  66. writeln('Usage: ',ExeName,' -h');
  67. end;
  68.  
  69. var
  70. Application: Student;
  71. begin
  72. Application:=Student.Create(nil);
  73. Application.Title:='Student';
  74. Application.Run;
  75. Application.Free;
  76. end.
Add Comment
Please, Sign In to add comment