日历
公告
分类
日志列表
最新回复
最新留言
链接
统计信息
搜索
其它


虾米的blog!
  读取INI配置文件GetProfileString和GetPrivateProfileString参
 

/
/读取win.ini配置文件
DWORD GetProfileString(
  LPCTSTR lpAppName,        // section name
  LPCTSTR lpKeyName,        // key name
  LPCTSTR lpDefault,        // default string
  LPTSTR lpReturnedString,  // destination buffer
  DWORD nSize,              // size of destination buffer
);

//读取INI配置文件
DWORD GetPrivateProfileString(
  LPCTSTR lpAppName,        // section name
  LPCTSTR lpKeyName,        // key name
  LPCTSTR lpDefault,        // default string
  LPTSTR lpReturnedString,  // destination buffer
  DWORD nSize,              // size of destination buffer
  LPCTSTR lpFileName        // initialization file name
);
示例:
 CFileDialog myFileDialog(true,
 "ini",
 "NS900",
 OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT |
 OFN_ALLOWMULTISELECT|OFN_EXPLORER,
 "配置文件(*.ini)|*.ini||",
 NULL);
 
 if(myFileDialog.DoModal() == IDOK)
 {
  CString strPath = myFileDialog.GetPathName();
  //打开文件显示
  CString str;
  int nSize = 254;
  GetPrivateProfileString("NS900","身份码",NULL,str.GetBuffer(254),nSize,strPath);
 }

[ 阅读全文 | 回复(0) | 引用通告 | 编辑

  Post  by  虾米 发表于 2007-12-26 16:03:00
发表评论:
Power By
Powered by Oblog.
错误: 无法读取页脚文件。