IniFileHelper类;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace UserGG
{
class IniFileHelper
{
string strIniFilePath; // ini配置文件路径
// 返回0表示失败,非0为成功
[DllImport("kernel32", CharSet = CharSet.Auto)]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
// 返回取得字符串缓冲区的长度
[DllImport("kernel32", CharSet = CharSet.Auto)]
private static extern long GetPrivateProfileString(string section, string key, string strDefault, StringBuilder retVal, int size, string filePath);
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetPrivateProfileInt(string section, string key, int nDefault, string filePath);
/// <summary>
/// 无参构造函数
winform 读写ini文件
最新推荐文章于 2023-07-30 20:30:14 发布