在声明时加上参数CharSet = CharSet.Unicode
[DllImport("kernel32", CharSet = CharSet.Unicode)]
CharSet: 指示如何向方法封送字符串参数...最后,附上读写ini文件,解决出现乱码的代码
[DllImport("kernel32", CharSet = CharSet.Unicode)]
private static extern long...string key, string def, StringBuilder retVal, int size, string filePath);
///
///读取ini...="def">默认值
/// 文件路径
/// 读出内容
public static...GetPrivateProfileString(Section, Key, def, temp, 4096, filePath);
return temp.ToString();
}
///
/// 写入数据到ini