void CWriteINI_expDlg::OnWrite()
{
CString inifilepath = "c:\\test.ini";
CString str;
GetDlgItem(IDC_DATE)->GetWindowText(str);
if(WritePrivateProfileString(_T("section"),_T("key"),str,inifilepath))
MessageBox("Done");
}
WritePrivateProfileString(_T("section"),_T("key"),str,inifilepath)
这个函数
[section]
key=(IDC_DATE的值)
void CWriteINI_expDlg::OnRead()
{
CString inifilepath = "c:\\test.ini";
CString str;
int i=0;
DWORD result = ::GetPrivateProfileInt(_T("section"),_T("key"),i,inifilepath);
str.Format("%d",result);
GetDlgItem(IDC_DATE)->SetWindowText(str);
}
评论