RE: To inpute lines in win.ini file by dirknerpin
dirknerpin
Wed May 11 16:15:38 CDT 2005
Below are two ruitines I've written for VFP9 that I qucikly made compatible
with VFP6, if that's what you're using. Left VFP9 stuff in, but commented
out.
*********************************************************************
* WriteINI - Writes an item to an INI file, pretty straight forward *
*********************************************************************
PROCEDURE WriteINI &&(cINIFile AS String, cTopic AS String, cItem AS String,
cValue AS String)
LPARAMETERS cINIFile, cTopic, cItem, cValue
DECLARE INTEGER WritePrivateProfileString IN Win32API ;
STRING cTopic, ;
STRING cItem, ;
STRING cValue, ;
STRING cINIFile
WritePrivateProfileString(m.cTopic, m.cItem, m.cValue, m.cINIFile)
ENDPROC
********************************************************************
* ReadINI - Reads values from an INI file, pretty straight forward *
********************************************************************
FUNCTION ReadINI &&(cINIFile As String, cTopic AS String, cItem AS String)
AS String
LPARAMETERS cINIFile, cTopic, cItem
DECLARE INTEGER GetPrivateProfileString IN Win32API ;
STRING cTopic, ;
STRING cItem, ;
STRING cDefault, ;
STRING cValueBuf, ;
INTEGER nValueBufSize, ;
STRING cINIFile
PRIVATE cValue, nBuf
m.cValue = REPLICATE(CHR(0), 255)
m.nBuf = GetPrivateProfileString(m.cTopic, m.cItem, '', @cValue, 255,
m.cINIFile)
RETURN LEFT(m.cValue, m.nBuf)
ENDFUNC