Menu

[r1]: / MOTDedit.pas  Maximize  Restore  History

Download this file

60 lines (50 with data), 1.1 kB

 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
unit MOTDedit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TplineMOTD = class(TForm)
motd: TMemo;
MyDir: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
plineMOTD: TplineMOTD;
implementation
{$R *.DFM}
procedure TplineMOTD.FormClose(Sender: TObject; var Action: TCloseAction);
Var F:TextFile;
L:LongInt;
begin
AssignFile(F,MyDir.Text+'\Config\MOTD.cfg');
Rewrite(F);
If motd.Lines.Count<>-1 then
For L:=0 to motd.Lines.Count-1 do
Writeln(F,motd.Lines[L]);
CloseFile(F);
end;
procedure TplineMOTD.FormShow(Sender: TObject);
Var F:TextFile;
J:String;
begin
AssignFile(F,MyDir.Text+'\Config\MOTD.cfg');
{$I-}
Reset(F);
{$I+}
If IOResult=0 then
Begin
While not Eof(F) do
Begin
Readln(F,J);
MOTD.Lines.Add(J);
End;
CloseFile(F);
End;
end;
end.