If we need to use the writeprivateprofilestring of the Win32 API function
For this function, we first need to declare this function in the form that calls this function.
If we want to execute it in the click function of a button, we should write it like this
* -- Define write applicationProgramDLL Functions of INI files
Declare integer writeprivateprofilestring in WIN32API as writeprivstr;
String csection, string ckey, string cvalue, string cinifile
Set path to "E: \ foxproproject"
& Do writeinifile in writeinifile with "Hello World"
Writeinifile ("Hello World ")
Writeinifile. PRG content
Procedure writeinifile
Parameters lcvalue
Constring = "connectionstring"
Lcentry = "ABC"
= Writeprivstr (constring, lcentry, lcvalue, curdir () + "formposi. ini ")
MessageBox (lcvalue)
Endproc
Note:
The comment identifier of FoxPro is &, or * | *
When we call a function, the function is generally written in the PRG file.
If we do not want to use do function in prgfile with parameter
The function name should be consistent with the file name for saving the function.
Curdir () is the path set by the application. After the program is executed, if the formposi. ini file cannot be found in the current path
In the command window, execute? Curdir () command to check which directory the current directory is
Environment: VFP 9.0 SP2