windows服务读写Ini文件
来源:互联网 发布:知乎 丁芙妮马上上 编辑:程序博客网 时间:2024/06/06 11:40
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//string cmds = "shutdown -s -t30";
string inipath = @"c:/mimi.ini";
IniFile(inipath);
string cmds = IniReadValue("mimi", "bobo");
//System.Windows.Forms.MessageBox.Show(cmds);
ProcessCmd(cmds);
}
//文件INI名称
public string Path;
////声明读写INI文件的API函数
[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文件名
public void IniFile(string inipath)
{
//
// TODO: Add constructor logic here
//
Path = inipath;
}
//写INI文件
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();
}
- windows服务读写Ini文件
- C++ Windows读写INI文件
- windows API 读写ini文件
- windows系统读写INI文件的API
- C#读写INI文件
- INI文件的读写
- C#读写INI文件
- C#读写INI文件
- C#读写INI文件
- 读写INI文件
- 如何读写INI 文件
- 读写INI文件
- INI文件读写
- 读写Ini文件
- INI文件的读写
- 读写INI文件
- c#读写ini文件
- C#读写INI文件
- 文件的操作
- 请加入 Debian 中文翻译!
- 【转】海量数据题目收集
- 语言喜爱程度:C > C++ > C#
- Newtonsoft.Json序列化和反序列
- windows服务读写Ini文件
- C# 对象的拷贝
- oracle常用命令
- echo $PATH
- 创新工厂的笔试题目
- WinXP IIS 5.1 PHP 5.3 VC9.0 配置详解
- web应用程序测试方法和测试技术详述
- 用.net实现网站验证码功能
- 网络传输——XML文档的序列化