-
Notifications
You must be signed in to change notification settings - Fork 1
/
Inifile.pas
65 lines (53 loc) · 1.63 KB
/
Inifile.pas
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
65
{*******************************************************}
{ }
{ Delphi Runtime Library }
{ Windows Messages and Types }
{ }
{ Copyright (c) 1991,96 Walter Alves Chagas Junior }
{ }
{*******************************************************}
unit Inifile;
interface
uses
Windows, Dialogs, Messages, SysUtils, Classes, Controls, StdCtrls, Graphics,
Inifiles;
function LeIni(Inifile:String;Secao:String;Chave:String):String;
procedure CriaIni(Inifile:String);
procedure GravaIni(Inifile:String;Secao:String;Chave:String;valor:String);
implementation
procedure CriaIni(Inifile:String);
var
Ini: TIniFile;
begin
Ini := TInifile.Create(GetCurrentDir+'\'+Inifile+'.ini');
try
Ini.WriteString('Section','Path',GetCurrentDir);
Ini.WriteString('Section','Data',GetCurrentDir +'\Data');
Ini.WriteString('Section','Sounds',GetCurrentDir+'\Sons');
finally
Ini.Free;
end;
end;
procedure GravaIni(Inifile:String;Secao:String;Chave:String;valor:String);
var
Ini: TIniFile;
begin
Ini := TInifile.Create(GetCurrentDir+'\'+Inifile+'.ini');
try
Ini.WriteString(Secao,chave,valor);
finally
Ini.Free;
end;
end;
Function LeIni(Inifile:String;Secao:String;Chave:String):String;
var
Ini: TIniFile;
Begin
Ini := TInifile.Create(GetCurrentDir+'\'+Inifile+'.ini');
try
Result := Ini.ReadString(Secao,chave,'');
finally
Ini.Free
end;
end;
end.