疯狂的VFPER之存取INI文件
一晃真正用VFP写程序也已6年多了,大大小小也做了几十个系统,曾经有多少个日夜坐在电脑前敲打着空格、回车...,突然发现我在论坛上回贴的多,发贴的少,决定痛改前非:)...闲话少说,言归正传,我会陆续将我的部份VFP代码给大家分享(并不一定都是我的原创,有些是在其他VFPER的代码上改的)。疯狂的VFPER之存取INI文件
*读取ini文件
Procedure ReadIni
Parameters tcFile,tcNodeName,tcFieldName &&文件,节点,字段
If !File(tcFile)
Return .F.
Endif
Private lcBuffer,lnBuffersize
Local lcBuffer,lnBuffersize
lnBuffersize = 128
lcBuffer = Space(lnBuffersize) + Chr(0)
Declare Integer GetPrivateProfileString ;
In Win32API As GetPrivStr ;
String, String, String, String @, Integer, String
=GetPrivStr(tcNodeName,tcFieldName,"", @lcBuffer,Len(lcBuffer),tcFile)
lcBuffer = Alltrim(Left(lcBuffer,At(Chr(0),lcBuffer)-1))
Return lcBuffer
Endfunc
*写入ini文件
Procedure WriteIni
Parameters tcFile,tcNodeName,tcFieldName,lcValue &&文件,节点,字段,值
Declare Integer WritePrivateProfileString ;
In Win32API As WritePrivStr ;
String, String, String, String
=WritePrivStr(tcNodeName,tcFieldName,lcValue,tcFile)
Endproc