using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text; namespace MyClock
{
/// <summary>
/// Ini 的摘要说明。
/// </summary>
public class Ini
{ public string path; //INI文件名
public Ini(string INIPath)
{
//
// TODO: 在此处添加构造函数逻辑
//
path = INIPath; }
[DllImport("kernel32")] private static extern long WritePrivateProfileString(string
section,string key,string val,string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section,string key, string def,StringBuilder retVal,int size,string filePath); //声明读写INI文件的API函数
public void IniWriteValue(string Section,string Key,string Value) { WritePrivateProfileString(Section,Key,Value,this.path); } //写INI文件 public string IniReadValue(string Section,string Key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section,Key,"",temp,255,this.path); return temp.ToString(); } //读取INI文件指定
}
}
using System.IO;
using System.Runtime.InteropServices;
using System.Text; namespace MyClock
{
/// <summary>
/// Ini 的摘要说明。
/// </summary>
public class Ini
{ public string path; //INI文件名
public Ini(string INIPath)
{
//
// TODO: 在此处添加构造函数逻辑
//
path = INIPath; }
[DllImport("kernel32")] private static extern long WritePrivateProfileString(string
section,string key,string val,string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section,string key, string def,StringBuilder retVal,int size,string filePath); //声明读写INI文件的API函数
public void IniWriteValue(string Section,string Key,string Value) { WritePrivateProfileString(Section,Key,Value,this.path); } //写INI文件 public string IniReadValue(string Section,string Key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section,Key,"",temp,255,this.path); return temp.ToString(); } //读取INI文件指定
}
}
解决方案 »
- Picturebox 显示GIF图片 出现GDI+中出现一般性错误。
- WinForm程序用.netFramework 4.0写的,要在低版本的framework的机器上运行
- C#中正则表达式中换行的处理
- C#中怎么不能用带有/d的正则表达式啊?
- .netC/S结构发邮件时的问题
- 分段读取的byte[]如何整合到一起?在线急等
- VSwinfrom中DataGridView中如何画一行多列?
- 怪异的错误 不知你碰过没?
- 请问用C#如何得到用毫秒,表示的系统时间?
- 哪里有数据库开发的好书,好例子哦!请给位帮帮忙
- 请问如何在C#中操作WORD文档?
- 怎么使用SqlDataReader读取image类型字段的值?
http://developer.ccidnet.com/pub/disp/Article?columnID=294&articleID=26002&pageNO=1
希望对你有所帮助