求读写ini文件的方法和对异常处理的方法(VB)

来源:百度知道 编辑:UC知道 时间:2024/06/04 09:25:11
如何读写ini 文件 简明1点
如何对读取中的错误 进行处理
如 没NTFS文件系统的读权限 导致的读取错误

给你两个函数,一个是读的,一个是写的。自己慢慢研究。如果实在不明白。就加我qq93681992
void CWrite_iniDlg::OnWrite()
{
// TODO: Add your control notification handler code here
CString m_strExePath;
CString m_strIniPath;
::GetModuleFileName(NULL,m_strExePath.GetBuffer(MAX_PATH),MAX_PATH);
m_strExePath.ReleaseBuffer();
int nPos=m_strExePath.ReverseFind('\\');
m_strExePath = m_strExePath.Left(nPos);
m_strIniPath.Format("%s\\DLG.ini",m_strExePath);

CString strData;
::WritePrivateProfileString("Param","Line","1",m_strIniPath);
::WritePrivateProfileString("Param","TrackNo","2",m_strIniPath);
::WritePrivateProfileString("Param","State","3",m_strIniPath);
::WritePrivateProfileString("Param","ScreenMod","4",m_strIniPath);
}

void CWrite_iniDlg::OnRead()
{
//