subject_23659.htm
来自「一些关于vc的问答」· HTM 代码 · 共 36 行
HTM
36 行
<p>
序号:23659 发表者:流枫 发表日期:2002-12-05 17:18:06
<br>主题:如何让基于对话框的程序不显示对话框,直接结束
<br>内容:我遇到的问题是,我想让对话框程序不显示对话框,直接结束,但我的程序在debug下没有错误,但在release下却在执行结束之后报错?请问我该如何做?<BR>initinstase函数的返回值对程序有什么影响,如果为false在release出错,如果为true,debug下出错.怎么回事?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:Norton AntiVirus 回复日期:2002-12-05 17:25:36
<br>内容:你可以在OnInitDialog中加入<BR>exit(0);<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-12-05 17:55:26
<br>内容:问题已解决,多谢。<BR>但我还是不明白。我的程序原来是在initinstanse中判断是否输入命令参数,如果有参数我就做一些事情,return false(对话框没有domodal),如果没有参数就让对话框domodal。<BR>但是这样在debug下是通过的,在release下出错。如果我把initinstanse函数的返回值设为true,release下不报错,但是程序没有关闭,但界面不显示,在debug下报错.能给我讲一下其中的道理么?让我也好明白明白?承蒙指教。
<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-12-05 22:01:25
<br>内容:<BR>把initinstance里代码paste上来
<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-12-05 22:59:52
<br>内容:重载DoModel,不要调用CDialog::DoModel(),而是直接调用Create()函数创建窗体,然后隐藏窗体。在程序结束后,发送WM_DESTORY消息,重载WM_DESTORY消息的响应函数,在最后加入Delete this。
<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-12-06 10:58:08
<br>内容:BOOL CS470CompGUIApp::InitInstance()<BR>{<BR><BR>#ifdef _AFXDLL<BR> Enable3dControls(); <BR>#else<BR> Enable3dControlsStatic(); <BR>#endif<BR><BR> CCommandLineInfo cmdInfo;<BR> ParseCommandLine(cmdInfo); <BR><BR> CS470CompGUIDlg dlg;<BR> m_pMainWnd = &dlg;<BR><BR> if ( cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen) )<BR> {<BR> char buf[256];<BR> GetCurrentDirectory(256,buf);<BR> CString s_Path = CString::CString(buf);<BR> g_App_Path = s_Path;<BR> if ( g_App_Path.Right(1) != "\\" )<BR> g_App_Path += "\\";<BR> g_Output_File = "gseq.dat";<BR><BR> CString str = cmdInfo.m_strFileName;<BR> int iPostion = str.ReverseFind('\\');<BR> CString sehin_name = str.Right(str.GetLength()-iPostion-1);<BR> g_System_Path = str.Left(iPostion);<BR><BR> if ( g_System_Path.Right(1) != "\\" )<BR> g_System_Path += "\\";<BR> g_Source_File = str + ".seq";<BR> g_Name_File = str + ".otp";<BR> g_Defile_File = str + ".def";<BR><BR> g_Output_File = "gseq.dat";<BR> dlg.Compile();<BR> }<BR> else <BR> { <BR> int nResponse = dlg.DoModal();<BR> if (nResponse == IDOK)<BR> {<BR> }<BR> else if (nResponse == IDCANCEL)<BR> {<BR> }<BR> }<BR> return FALSE;<BR>}
<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 + =
减小字号Ctrl + -
显示快捷键?