⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_20892.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:20892 发表者:韩顺平 发表日期:2002-11-11 22:26:51
<br>主题:请教一个关于基于Dialog的应用程序的问题
<br>内容:&nbsp;&nbsp;谢谢各位!<BR>&nbsp;&nbsp;我用AppWizard生成一个应用程序其CfffffApp的代码如下:<BR>&nbsp;&nbsp;// fffff.cpp : Defines the class behaviors for the application.<BR>//<BR><BR>#include "stdafx.h"<BR>#include "fffff.h"<BR>#include "fffffDlg.h"<BR><BR>#ifdef _DEBUG<BR>#define new DEBUG_NEW<BR>#undef THIS_FILE<BR>static char THIS_FILE[] = __FILE__;<BR>#endif<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CFffffApp<BR><BR>BEGIN_MESSAGE_MAP(CFffffApp, CWinApp)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG_MAP(CFffffApp)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// NOTE - the ClassWizard will add and remove mapping macros here.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;DO NOT EDIT what you see in these blocks of generated code!<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_COMMAND(ID_HELP, CWinApp::OnHelp)<BR>END_MESSAGE_MAP()<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CFffffApp construction<BR><BR>CFffffApp::CFffffApp()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: add construction code here,<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Place all significant initialization in InitInstance<BR>}<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// The one and only CFffffApp object<BR><BR>CFffffApp theApp;<BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CFffffApp initialization<BR><BR>BOOL CFffffApp::InitInstance()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;AfxEnableControlContainer();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Standard initialization<BR>&nbsp;&nbsp;&nbsp;&nbsp;// If you are not using these features and wish to reduce the size<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;of your final executable, you should remove from the following<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;the specific initialization routines you do not need.<BR><BR>#ifdef _AFXDLL<BR>&nbsp;&nbsp;&nbsp;&nbsp;Enable3dControls();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Call this when using MFC in a shared DLL<BR>#else<BR>&nbsp;&nbsp;&nbsp;&nbsp;Enable3dControlsStatic();&nbsp;&nbsp;&nbsp;&nbsp;// Call this when linking to MFC statically<BR>#endif<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;CFffffDlg dlg;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_pMainWnd = &dlg;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;int nResponse = dlg.DoModal();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Afxmessage(“不向下执行”);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;if (nResponse == IDOK)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Place code here to handle when the dialog is<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;dismissed with OK<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else if (nResponse == IDCANCEL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AfxMessageBox("");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Place code here to handle when the dialog is<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;dismissed with Cancel<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Since the dialog has been closed, return FALSE so that we exit the<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;application, rather than start the application's message pump.<BR>&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR>}<BR><BR>int CFffffApp::ExitInstance() <BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Add your specialized code here and/or call the base class<BR>&nbsp;&nbsp;&nbsp;&nbsp;//AfxMessageBox("");<BR>&nbsp;&nbsp;&nbsp;&nbsp;return CWinApp::ExitInstance();<BR>}<BR>请教在执行int nResponse = dlg.DoModal();语句后生成一个对话框。按对话框的关闭窗口或按确定或取消按钮 。 Afxmessage(“不向下执行”);这句话都不执行。<BR>怎样才能在取消对话框后让Afxmessage(“不向下执行”);这句话执行?<BR>谢谢各位大侠!<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:混混 回复日期:2002-11-11 22:50:15
<br>内容:如果你的代码真如上面所示, 是编译通不过, 更别说执行了<BR><BR>我估计没错的话, 你应该把<BR><BR>Afxmessage(“不向下执行”);<BR><BR>改成<BR><BR>AfxMessageBox("不向下执行");<BR><BR>注意不要用中文标点符号
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:萧马 回复日期:2002-11-11 23:04:23
<br>内容:在MSDN中根本就查不到AfxMessage,呵呵。你那段代码即使用AfxMessageBox,在弹出对话框的同时立刻就会弹出“不向下执行”的系统对话框。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:不说 回复日期:2002-11-12 00:56:45
<br>内容:敲打一下楼上的脑袋……DoModal()的时候程序会阻塞在那句话上,知道modal的对话框干掉自己才会向下执行,要不怎么叫modal的对话框捏?<BR><BR>这句话其实执行了,对话框也弹出来了,只不过你已经看不到它了呵呵,因为这个时候你的dialog的窗口已经把自己destroy掉了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:韩顺平 回复日期:2002-11-12 09:32:06
<br>内容:谢谢各位!<BR>&nbsp;&nbsp;&nbsp;&nbsp;混混 和萧马 说的都是在下的笔误,编译连接没问题,运行没问题。就是在按下按对话框的关闭窗口或按确定或取消按钮 后,应用程序推出,但是,没有执行AfxMessageBox("不想下执行");.<BR>&nbsp;&nbsp;&nbsp;&nbsp;谢谢各位指教。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:不说 回复日期:2002-11-12 12:24:06
<br>内容:靠……死心眼告诉你执行了你怎么还说没执行……
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:浩公 回复日期:2002-11-12 20:30:59
<br>内容:靠?“觉?留到咯P以后再睡吧………… ”终于看懂这句话了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:萧马 回复日期:2002-11-12 20:40:59
<br>内容:我说今天头晕,原来是被人敲了,呵呵。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:韩顺平 回复日期:2002-11-12 21:33:19
<br>内容: 谢谢各位老大!<BR> 我知道执行了。但是为什么不跳出一个对话框您?
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:cool 回复日期:2002-11-13 15:53:31
<br>内容:此时已经退出了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:韩顺平 回复日期:2002-11-14 09:08:52
<br>内容:&nbsp;&nbsp;cool !<BR>&nbsp;&nbsp;此时已经退出了是什么意思,难道在AfxMessageBox("下执行")在执行前,应用程序就推出了吗?<BR>&nbsp;&nbsp;谢谢指教!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:无非 回复日期:2002-11-14 09:46:26
<br>内容:因为你的提示框是在对话框中创建的,当你关闭对话框,也就是退出了你的程序,于是,他撤消对话框和它创建的窗口--AfxMessageBox。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:韩顺平 回复日期:2002-11-14 11:33:59
<br>内容:&nbsp;&nbsp;&nbsp;&nbsp;谢谢无非 !
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -