-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigfile.pas
68 lines (59 loc) · 1.63 KB
/
configfile.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
66
67
68
unit configfile;
interface
type
TSettingsRec = record
Left, Top, Width, Height : integer;
CanvasLeft, CanvasTop : integer;
ToolLeft, ToolTop : integer;
WindowState : integer;
ODFilePath : string[255]; //open dialog
OPFilePath : string[255]; //open picture
OSFilePath : string[255]; //open sound
AviFilePath : string[255];
SaveFilePath : string[255];
OpenFilePath : string[255];
end;
function LoadSettings(strFileName : string; var recSettings : TSettingsRec) : BOOLEAN;
procedure SaveSettings(strFileName : string; recSettings : TSettingsRec);
implementation
uses SysUtils, Windows;
function LoadSettings(strFileName : string; var recSettings : TSettingsRec) : BOOLEAN;
var
t : file of TSettingsRec;
begin
LoadSettings := FALSE;
if (FileExists(strFileName)) then
begin
assignfile(t, strFileName);
{$I-}
Reset(t);
{$I+}
if IOResult = 0 then
begin
read(t, recSettings);
closefile(t);
LoadSettings := TRUE;
end else
begin
//MessageBox(getdesktopwindow, pChar('Could not load settings, error ' + inttostr(IOResult)), 'Error', MB_OK or MB_ICONERROR);
end;
end;
end;
procedure SaveSettings(strFileName : string; recSettings : TSettingsRec);
var
t : file of TSettingsRec;
begin
assignfile(t, strFileName);
{I-}
rewrite(t);
{I+}
if IOResult = 0 then
begin
write(t, recSettings);
closefile(t);
end else
begin
//MessageBox(getdesktopwindow, pChar('Could not save settings, error ' + inttostr(IOResult)), 'Error', MB_OK or MB_ICONERROR);
end;
end;
end.