vc6.0中MFC 使用AfxMessageBox,点击确定后,怎么返回主窗体,而不是退出程序

vc6.0中MFC 使用AfxMessageBox,点击确定后,如何返回主窗体,而不是退出程序?
vc6.0中MFC 使用AfxMessageBox,点击确定后,如何返回主窗体,而不是退出程序?
例如我是这样写的:
void CCpuControlDlg::OnButton6() 
{
// TODO: Add your control notification handler code here
ret= add(1,2);
if(ret==0)
{
AfxMessageBox("成功!");

}
else
{

AfxMessageBox("失败!");
return;
}

}
但是,点确定后程序就退出了,我想让他返回主窗体,可以点击其他按钮。哪位大侠知道?谢谢!

------解决方案--------------------
光看这些代码,不应该
------解决方案--------------------
没有错误
------解决方案--------------------
楼主这个问题有点诡异啊
------解决方案--------------------
探讨
vc6.0中MFC 使用AfxMessageBox,点击确定后,如何返回主窗体,而不是退出程序?
例如我是这样写的:
void CCpuControlDlg::OnButton6()
{
// TODO: Add your control notification handler code here
ret= add(1,2);
if(ret==0)
{
AfxMessageBo……

------解决方案--------------------
你的ret是在哪里定义的?全局变量还是CCpuControlDlg类的成员?
------解决方案--------------------
AfxMessageBox("失败!");
return;
这个return你是干嘛用的?
------解决方案--------------------
Dialog上的一个Button,没问题啊
------解决方案--------------------
楼主是不是按了二次“回车”?

第一次是 AfxMessageBox 接受了。
但第二次是对话框接受了,所以就自动退出程序了。

如果是这样就用类向导添加 PreTranslateMessage :

BOOL CWorkDlg::PreTranslateMessage(MSG* pMsg) 
{
// CG: The following block was added by the ToolTips component.
{
// Let the ToolTip process this message.
m_tooltip.RelayEvent(pMsg);
}
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)//
if(pMsg->wParam == VK_ESCAPE )//|| pMsg->wParam == VK_RETURN)
return TRUE;// 忽略 Esc & 回车

return CDialog::PreTranslateMessage(pMsg);
}