2个回答
2011-12-08
展开全部
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retvalue, int siz, string inipath);
static public string IniRead(string section, string skey, string iniPath)
{
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(sSection, sKey, "null", sbTemp, 1024, sIniPath);
return temp.ToString();
}
string inipath = "ini文件的路径";
string username = IniRead("UserName", "Name", inipath);
string password = IniRead("Password", "password ", inipath );
ini文件
[UserName]
Name = xxx
[Password]
password = xxx
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retvalue, int siz, string inipath);
static public string IniRead(string section, string skey, string iniPath)
{
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(sSection, sKey, "null", sbTemp, 1024, sIniPath);
return temp.ToString();
}
string inipath = "ini文件的路径";
string username = IniRead("UserName", "Name", inipath);
string password = IniRead("Password", "password ", inipath );
ini文件
[UserName]
Name = xxx
[Password]
password = xxx
更多追问追答
追问
感谢你的回答,但这些代码我贴在哪里???呵呵
追答
你哪里获取帐号和密码就贴在哪里
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询