Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make my application use ini file

Status
Not open for further replies.

Takusaan

Programmer
Sep 20, 2000
29
US
I have created a scanning Application in VFP 6.0. And I want my scanner to use the ini file that I specified.
 
Here two function that I used for this:

FUNCTION ReadIniString(cSection, cEntry, cIniFile)
LOCAL ret_val
DECLARE INTEGER GetPrivateProfileString IN Win32API AS GetPrivStr ;
String cSection, String cKey, String cDefault, String @cBuffer, ;
Integer nBufferSize, String cINIFile
m.ret_val = SPACE(1024)
GetPrivStr(m.cSection, m.cEntry,"",@ret_val,1024,m.cIniFile)
CLEAR DLLS GetPrivateProfileString
RETURN STRTRAN(ALLTRIM(ret_val), CHR(0), "")

FUNCTION WriteIniString(cSection, cEntry, cString, cIniFile)
DECLARE INTEGER WritePrivateProfileString IN Win32API AS WritePrivStr ;
String cSection, String cKey, String cValue, String cINIFile
WritePrivStr(m.cSection,m.cEntry,m.cString,m.cIniFile)
CLEAR DLLS WritePrivateProfileString
RETURN ""

*** Usage:
WriteIniString([Main],[TestEntry],[AbraKadabra],[MyIniFile.Ini])
? ReadIniString([Main], [TestEntry], [MyIniFile.Ini])
[/code]

Borislav Borissov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top