用c#做出1、通过INI文件传入需要浏览的目录位置, 如何获取ini文件内的目录位置呢,详细些,谢谢
1个回答
展开全部
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath); //调用DLL
/// <summary>
/// 读出INI文件
/// </summary>
/// <param name="Section">项目名称(如 [TypeName] )</param>
/// <param name="Key">键</param>
public string IniReadValue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(500);
int i = GetPrivateProfileString(Section,Key,"",temp,500,this.inipath);
return temp.ToString();
}
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath); //调用DLL
/// <summary>
/// 读出INI文件
/// </summary>
/// <param name="Section">项目名称(如 [TypeName] )</param>
/// <param name="Key">键</param>
public string IniReadValue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(500);
int i = GetPrivateProfileString(Section,Key,"",temp,500,this.inipath);
return temp.ToString();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询