Ini文件操作

//ini也可以实现多级菜单操作,需要递归搜索ini文件

TiniOptiType=(IniOpDelete,IniOpWrite,IniOpRead) //声明了一个删除、写、读的枚举类型
function iniOptiOnce(Fpath:string;IniOptiType:TiniOptiType;sec:string;key:string;value:string='';strDef:string=''):string; var configIni:TIniFile; begin Result:=''; if not FileExists(Fpath) then Exit; configIni:=TIniFile.Create(Fpath); try case IniOptiType of IniOpDelete: begin configIni.DeleteKey(sec,key); end; IniOpWrite: begin configIni.WriteString(sec,key,value); end; IniOpRead: begin Result:=configIni.ReadString(sec,key,strDef); end; end; finally configIni.Free; end; end;

 

 

posted @ 2013-05-29 14:38  胖达没有海  阅读(236)  评论(0编辑  收藏  举报