没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
这个 CMainDlg类 界面类是举例...的
//-----------------------CMainDlg.h--函数定义---------------------------------
class CMainDlg : public CDialog
{
...
static void SaveConfigFile(CWnd* pWnd, UINT Contrlid[], int nCount);
static void RestoreConfigFile(CWnd* pWnd);
//使用方法
void OnBnClickBtnRestorefile();//保存配置的调用举例
void OnBnClickBtnRestorefile();//恢复配置的调用举例
......
}
//-----------------------CMainDlg.cpp--函数实现---------------------------------
参数UINT Contrlid[]==>是不要保存的控件id号,在resource.h可以找到id号
参数int nCount ==>个数
void CMainDlg::SaveConfigFile(CWnd* pWnd, UINT Contrlid[], int nCount)
{
CString strTmp;
CString strContrlType;
CString strContrlText;
CString strContrlId;
CWnd* pChildwnd = pWnd->GetWindow(GW_CHILD);
while (pChildwnd != NULL)
{
for (int i = 0; i < nCount; ++i)
{
CWnd* pWndremove = pWnd->GetDlgItem(Contrlid[i]);
if (pWndremove == pChildwnd)
{
goto MyNextHwnd;
}
}
char szClzzName[64] = { 0 };
::GetClassNameA(pChildwnd->GetSafeHwnd(), szClzzName, 64);
if (_tcsicmp(szClzzName, "Edit") == 0)
{
strContrlType = "Edit";
int nId = pChildwnd->GetDlgCtrlID();
strContrlId.Format("%d", nId);
pChildwnd->GetWindowText(strContrlText);
strTmp += strContrlType + "|" + strContrlId + "|" + strContrlText + "\n";
}
if (_tcsicmp(szClzzName, "ComboBox") == 0) // 这个同Edit
{
strContrlType = "ComboBox";
int nId = pChildwnd->GetDlgCtrlID();
strContrlId.Format("%d", nId);
pChildwnd->GetWindowText(strContrlText);
CString strContrlId;
CWnd* pChildwnd = pWnd->GetWindow(GW_CHILD);
while (pChildwnd != NULL)
{
for (int i = 0; i < nCount; ++i)
{
CWnd* pWndremove = pWnd->GetDlgItem(Contrlid[i]);
if (pWndremove == pChildwnd)
{
goto MyNextHwnd;
}
}
char szClzzName[64] = { 0 };
::GetClassNameA(pChildwnd->GetSafeHwnd(), szClzzName, 64);
if (_tcsicmp(szClzzName, "Edit") == 0)
{
strContrlType = "Edit";
int nId = pChildwnd->GetDlgCtrlID();
strContrlId.Format("%d", nId);
pChildwnd->GetWindowText(strContrlText);
strTmp += strContrlType + "|" + strContrlId + "|" + strContrlText + "\n";
}
if (_tcsicmp(szClzzName, "ComboBox") == 0) // 这个同Edit
{
strContrlType = "ComboBox";
int nId = pChildwnd->GetDlgCtrlID();
strContrlId.Format("%d", nId);
pChildwnd->GetWindowText(strContrlText);
剩余7页未读,继续阅读
资源评论
yuweiping
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功