using System.Text;
using System.Runtime.InteropServices;
namespace Win_F2P
{
class RW_IniFile
{
[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern bool WritePrivateProfileString(
string lpAppName, string lpKeyName, string lpString, string lpFileName);//块名称,key,value,配置文件的路径
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(
string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString,
int nSize, string lpFileName); //块名称,key,默认返回值,值载体,值载体的容量大小,配置文件的路径
StringBuilder temp = new StringBuilder();
public void Read_IniFile(string filePath)
{
GetPrivateProfileString("option", "Auto", "", temp, 255, filePath);
}
public void Write_IniFile(string filePath)
{
WritePrivateProfileString("option", "Auto", "false", filePath);
}
}
}