public class SetupIniIP
{
public string path;
[DllImport("kernel32", CharSet = CharSet.Unicode)]
private static extern long
WritePrivateProfileString(string
section, string key, string val, string filePath);
[DllImport("kernel32", CharSet = CharSet.Unicode)]
private static extern int
GetPrivateProfileString(string
section, string key, string def, StringBuilder retVal, int size, string filePath);
public void
IniWriteValue(string Section, string Key, string Value, string inipath)
{
WritePrivateProfileString(Section, Key, Value, inipath);
}
public string IniReadValue(string
Section, string Key, string inipath)
{
StringBuilder temp = new
StringBuilder(255);
int i =
GetPrivateProfileString(Section, Key, "", temp, 255, inipath);
return temp.ToString();
}
}
沒有留言:
張貼留言