读INI文件内容void CINI_File_TestDlg::OnButtonRead() 
{
// TODO: Add your control notification handler code here
CString strSection        = "Section1";
   CString strSectionKey     = "Item1";
char strBuff[256];
CString strValue        = _T("");
CString strFilePath;
strFilePath=GetCurrentDirectory(256,strBuff);   //获取当前路径
strFilePath.Format("%s\\Test.ini",strBuff);
GetPrivateProfileString(strSection,strSectionKey,NULL,strBuff,80,strFilePath); //读取ini文件中相应字段的内容
strValue=strBuff;
SetDlgItemText(IDC_EDIT_NAME,strValue);
strSectionKey="Item2";
GetPrivateProfileString(strSection,strSectionKey,NULL,strBuff,80,strFilePath);
strValue=strBuff;
SetDlgItemText(IDC_EDIT_PASSWORD,strValue);
UpdateData(FALSE);
}
CString strValue        = _T("");这个_T("")是什么意思?
UpdateData(FALSE); 这个函数什么作用,改成TRUE会怎样?
另外,这个CString这个类型谁能讲解下,以前学C或c++没用过。

解决方案 »

  1.   

    1、_T("")是转换字符编码用的,比如有时候我们会遇到诸如cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR'的错误问题2、UpdateData函数,参数有TRUE和FALSE两种,表示从控件读取变量,或者更新控件变量,改成TRUE自然就是读取,通俗理解是这样3、CString类,重载了很多操作符,我建议你GOOGLE一下,系统了解,一下子也说不来那么深
      

  2.   

    CString类那个东西很多,如果开始时不清楚,可以用TCHAR的数组来代替CString。
      

  3.   

    能将清楚点吗,控件是指哪个?EDIT 还是 BUTTON?我改成TRUE好像和FALSE没什么区别