关于Radio Button控件动态选中的有关问题
关于Radio Button控件动态选中的问题
我在基本对话框上面加两个Radio Button控件,分别为Radio1,Radio2
我想实现的功能是:
如果运行程序选中Radio1,则以后每次运行程序都会默认选中Radio1,如果运
行程序选中Radio2,则以后每次运行程序都会默认选中Radio2,概括来说就是每次
运行程序后默认选中的是上次程序结束时选中的Radio Button控件
希望高手们指点,希望有详细代码,谢谢!!!
------解决方案--------------------
::WritePrivateProfileString()//写
::GetPrivateProfileString()//读
参数自己找看看
------解决方案--------------------
每次选中是把结果写到文件,每次程序运行从文件中读出标识知道上次选中那个CHECK然后把其置为TURE:下面是把文件自动写到SYSTEM32下的代码:
写文件:
//得到系统盘路径
CString mFilename;
char systempath[100];
::GetSystemDirectory(systempath,50);
CString m_strfname;
CString newdata;
CString curfilename;
CString curfilpath;
//curfilpath = GetCurPath();
curfilpath = systempath;
curfilename = "\\servermarshal.ini ";
m_strfname = curfilpath + curfilename;
//在指定位置创建一个文件
CStdioFile m_file(m_strfname,CFile::modeCreate|CFile::modeWrite);
//设置文件长度,
m_file.SetLength(0);
//将结点表内容写入指定文件
m_file.WriteString(strFLG);
//关闭文件
m_file.Close();
读:
//得到系统盘路径
CString mFilename;
char systempath[100];
::GetSystemDirectory(systempath,50);
CString m_strfname;
CString newdata;
CString curfilename;
CString curfilpath;
//curfilpath = GetCurPath();
curfilpath = systempath;
curfilename = "\\servermarshal.ini ";
m_strfname = curfilpath + curfilename;
char m_str3[200];
CFile fis;
fis.Open(m_strfname,CFile::modeRead|CFile::typeBinary);
if(!fis)
{
AfxMessageBox( "FAILEDD ");
exit(1);
}
else
{
int m_newinflongth = fis.Read(m_str3,100);
m_str3[m_newinflongth]= '\0 ';
newdata = m_str3;
//AfxMessageBox(newdata);
}
我在基本对话框上面加两个Radio Button控件,分别为Radio1,Radio2
我想实现的功能是:
如果运行程序选中Radio1,则以后每次运行程序都会默认选中Radio1,如果运
行程序选中Radio2,则以后每次运行程序都会默认选中Radio2,概括来说就是每次
运行程序后默认选中的是上次程序结束时选中的Radio Button控件
希望高手们指点,希望有详细代码,谢谢!!!
------解决方案--------------------
::WritePrivateProfileString()//写
::GetPrivateProfileString()//读
参数自己找看看
------解决方案--------------------
每次选中是把结果写到文件,每次程序运行从文件中读出标识知道上次选中那个CHECK然后把其置为TURE:下面是把文件自动写到SYSTEM32下的代码:
写文件:
//得到系统盘路径
CString mFilename;
char systempath[100];
::GetSystemDirectory(systempath,50);
CString m_strfname;
CString newdata;
CString curfilename;
CString curfilpath;
//curfilpath = GetCurPath();
curfilpath = systempath;
curfilename = "\\servermarshal.ini ";
m_strfname = curfilpath + curfilename;
//在指定位置创建一个文件
CStdioFile m_file(m_strfname,CFile::modeCreate|CFile::modeWrite);
//设置文件长度,
m_file.SetLength(0);
//将结点表内容写入指定文件
m_file.WriteString(strFLG);
//关闭文件
m_file.Close();
读:
//得到系统盘路径
CString mFilename;
char systempath[100];
::GetSystemDirectory(systempath,50);
CString m_strfname;
CString newdata;
CString curfilename;
CString curfilpath;
//curfilpath = GetCurPath();
curfilpath = systempath;
curfilename = "\\servermarshal.ini ";
m_strfname = curfilpath + curfilename;
char m_str3[200];
CFile fis;
fis.Open(m_strfname,CFile::modeRead|CFile::typeBinary);
if(!fis)
{
AfxMessageBox( "FAILEDD ");
exit(1);
}
else
{
int m_newinflongth = fis.Read(m_str3,100);
m_str3[m_newinflongth]= '\0 ';
newdata = m_str3;
//AfxMessageBox(newdata);
}