下面一段程序是一个对话框上OK按钮的消息处理函数,
这个OK按钮点过后会出现一个子对话框但是我在Dioalog中并没找到这个资源什么回事?还有里面有好多公共的调用函数我都不知道是什么意思,请高手注释下。有用加分,谢谢。vo...
这个OK按钮点过后会出现一个子对话框但是我在Dioalog中并没找到这个资源什么回事?
还有里面有好多公共的调用函数我都不知道是什么意思,请高手注释下。有用加分,谢谢。
void COpenDlg::OnOK()
{
CString filterPrefix;
VERIFY(filterPrefix.LoadString(IDS_FILTER_PREFIX));
UpdateData(TRUE);
TrimPaths();
m_pathsType = GetPairComparability(m_strLeft, m_strRight);
if (m_pathsType == DOES_NOT_EXIST)
{
AfxMessageBox(IDS_ERROR_INCOMPARABLE, MB_ICONSTOP);
return;
}
m_strRight = paths_GetLongPath(m_strRight);
m_strLeft = paths_GetLongPath(m_strLeft);
// Add trailing '\' for directories if its missing
if (m_pathsType == IS_EXISTING_DIR)
{
if (!paths_EndsWithSlash(m_strLeft))
m_strLeft += '\\';
if (!paths_EndsWithSlash(m_strRight))
m_strRight += '\\';
}
UpdateData(FALSE);
KillTimer(IDT_CHECKFILES);
m_strExt.TrimLeft();
m_strExt.TrimRight();
// If prefix found from start..
if (m_strExt.Find(filterPrefix, 0) == 0)
{
// Remove prefix + space
m_strExt.Delete(0, filterPrefix.GetLength());
if (!theApp.m_globalFileFilter.SetFilter(m_strExt))
{
// If filtername is not found use default *.* mask
theApp.m_globalFileFilter.SetFilter(_T("*.*"));
m_strExt = _T("*.*");
}
mf->m_options.SaveOption(OPT_FILEFILTER_CURRENT, m_strExt);
}
else
{
BOOL bFilterSet = theApp.m_globalFileFilter.SetFilter(m_strExt);
if (!bFilterSet)
m_strExt = theApp.m_globalFileFilter.GetFilterNameOrMask();
mf->m_options.SaveOption(OPT_FILEFILTER_CURRENT, m_strExt);
}
SaveComboboxStates();
theApp.WriteProfileInt(_T("Settings"), _T("Recurse"), m_bRecurse);
CDialog::OnOK();
} 展开
还有里面有好多公共的调用函数我都不知道是什么意思,请高手注释下。有用加分,谢谢。
void COpenDlg::OnOK()
{
CString filterPrefix;
VERIFY(filterPrefix.LoadString(IDS_FILTER_PREFIX));
UpdateData(TRUE);
TrimPaths();
m_pathsType = GetPairComparability(m_strLeft, m_strRight);
if (m_pathsType == DOES_NOT_EXIST)
{
AfxMessageBox(IDS_ERROR_INCOMPARABLE, MB_ICONSTOP);
return;
}
m_strRight = paths_GetLongPath(m_strRight);
m_strLeft = paths_GetLongPath(m_strLeft);
// Add trailing '\' for directories if its missing
if (m_pathsType == IS_EXISTING_DIR)
{
if (!paths_EndsWithSlash(m_strLeft))
m_strLeft += '\\';
if (!paths_EndsWithSlash(m_strRight))
m_strRight += '\\';
}
UpdateData(FALSE);
KillTimer(IDT_CHECKFILES);
m_strExt.TrimLeft();
m_strExt.TrimRight();
// If prefix found from start..
if (m_strExt.Find(filterPrefix, 0) == 0)
{
// Remove prefix + space
m_strExt.Delete(0, filterPrefix.GetLength());
if (!theApp.m_globalFileFilter.SetFilter(m_strExt))
{
// If filtername is not found use default *.* mask
theApp.m_globalFileFilter.SetFilter(_T("*.*"));
m_strExt = _T("*.*");
}
mf->m_options.SaveOption(OPT_FILEFILTER_CURRENT, m_strExt);
}
else
{
BOOL bFilterSet = theApp.m_globalFileFilter.SetFilter(m_strExt);
if (!bFilterSet)
m_strExt = theApp.m_globalFileFilter.GetFilterNameOrMask();
mf->m_options.SaveOption(OPT_FILEFILTER_CURRENT, m_strExt);
}
SaveComboboxStates();
theApp.WriteProfileInt(_T("Settings"), _T("Recurse"), m_bRecurse);
CDialog::OnOK();
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询