inipas.pas
来自「EasyGasDpr 瓶装液化气 钢瓶 SQL,用户名:SYSTEM 密码:空」· PAS 代码 · 共 87 行
PAS
87 行
unit INIPAS ;
interface
uses INIFiles,SysUtils,Forms;
Function ReadINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):String;
Function ReadINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Integer;
Function ReadINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
Function WriteINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):Boolean;
Function WriteINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Boolean;
implementation
Function ReadINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):String;
var INI:TINIFile;
Begin
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
Result:=ReadString(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
end;
Function ReadINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Integer;
var INI:TINIFile;
Begin
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
Result:=ReadInteger(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
end;
Function ReadINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
var INI:TINIFile;
Begin
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
Result:=ReadBool(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
end;
Function WriteINIStr(Const BASE_NAME,SUB_NAME,DEFAULT_RESULT:String):Boolean;
var INI:TINIFile;
Begin
Result:=True; Try
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
WriteString(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
Except Result:=False; end;
end;
Function WriteINIInt(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Integer):Boolean;
var INI:TINIFile;
Begin
Result:=True; Try
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
WriteInteger(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
Except Result:=False; end;
end;
Function WriteINIBool(Const BASE_NAME,SUB_NAME:String;DEFAULT_RESULT:Boolean):Boolean;
var INI:TINIFile;
Begin
Result:=True; Try
INI:=TINIFile.Create(ExtractFilePath(Application.ExeName)+'CONFIG.INI');
With INI do
Begin
WriteBool(BASE_NAME,SUB_NAME,DEFAULT_RESULT);
end;
INI.Free;
Except Result:=False; end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?