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

📄 subject_54173.htm

📁 vc
💻 HTM
字号:
<p>
序号:54173 发表者:莹莹菜 发表日期:2003-09-26 09:37:11
<br>主题:学习VC第十一天的问题
<br>内容:我用的自学教材是《学用visual c++6.0》,我认为讲得还不错,因为我没有基础,今天是第十一天学习vc,有看过这本书的朋友,我真希望能够加我为好友,以后请多多指教!<BR><BR>今天按照教材做Fonts练习时,出现bug提示:<BR>Debug Assertion Failed!<BR>Program: E:\Myprogram\Debug\Myprogram.exe<BR>Line: 1120<BR>For information on how your program can cause an assertion failure, <BR>see the Visuall C++ documentation on asserts.<BR><BR>(Press Retry to debug the application)<BR><BR>请问这是什么原因?<BR><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>
回复者:iamhere 回复日期:2003-09-26 09:53:03
<br>内容:点击Retry,看看Call Stack中程序停留在哪句话上
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:莹莹菜 回复日期:2003-09-26 10:13:29
<br>内容:点击Retry后出现应用程序关闭的提示:<BR>Myprogram.exe 遇到问题需要关闭。我们对此引起的不便表示抱歉。<BR>......<BR><BR>和其它Windows应用程序bug的提示一样<BR><BR>(还是不知道怎样把提示信息框保存下来,你知道吗?)<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>
回复者:iamhere 回复日期:2003-09-26 10:15:43
<br>内容:在VC中按F5在Debug方式下运行,<BR>出错后查看Call Stack
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:莹莹菜 回复日期:2003-09-26 10:59:49
<br>内容:按你说的做了,按F5在Debug方式下运行,出现关闭提示后点击Retry,双箭头(==&gt;&gt;)指向如下:<BR>BOOL CGdiObject::Attach(HGDIOBJ hObject)<BR>{<BR>&nbsp;&nbsp;==&gt;&gt;&nbsp;&nbsp; ASSERT(m_hObject == NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// only attach once, detach on destroy<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (hObject == NULL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;CHandleMap* pMap = afxMapHGDIOBJ(TRUE); // create map if not exist<BR>&nbsp;&nbsp;&nbsp;&nbsp;ASSERT(pMap != NULL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pMap-&gt;SetPermanent(m_hObject = hObject, this);<BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;<BR>}<BR><BR>拜托问一下,Call Stack什么意思,怎么查看?
<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>回复者:iamhere 回复日期:2003-09-26 11:10:01
<br>内容:在你Retry之后,箭头指向如下的地方,<BR>菜单View-Debug Windows-Call Stack<BR>在新的Call Stack窗口中,从上到下依次点击过来,<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>
回复者:莹莹菜 回复日期:2003-09-26 12:32:57
<br>内容:谢谢iamhere!找到原因了,你能结合下面标出的语句给我解释一下Call Stack吗?<BR><BR>void CDay7Dlg::SetMyFont()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CRect rRect;&nbsp;&nbsp; // The rectangle of the display area<BR>&nbsp;&nbsp;&nbsp;&nbsp;int iHeight;&nbsp;&nbsp; // the heiht of the display area<BR>&nbsp;&nbsp;&nbsp;&nbsp;int iItalic = 0;&nbsp;&nbsp; // Italicize the font?<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Has a font been selected?<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (m_strFontList != &#34;&#34;)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the dimensions of the font sample display area<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_ctlDisplayText.GetWindowRect(&amp;rRect);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Calculate the area height<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iHeight = rRect.top - rRect.bottom;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Make sure the height is positive<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (iHeight &lt; 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iHeight = 0 - iHeight;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// should the font be italicized?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_bItalic)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iItalic = 1;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Release the current font<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;big&gt; m_fSampFont.Detach();&nbsp;&nbsp; 原来少了这一句&lt;/big&gt;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Creat the font to be used<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fSampFont.CreateFont((iHeight - 5), 0, 0, 0, FW_NORMAL, iItalic, 0, 0, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, m_strFontList);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Set the font for the sample display area<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_ctlDisplayText.SetFont(&amp;m_fSampFont);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<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>
回复者:iamhere 回复日期:2003-09-26 13:58:09
<br>内容:Call Stack调用堆栈,<BR>在这里可以看出函数调用的先后顺序,<BR>假如说在函数a中调用了函数b,那么在该调用堆栈中就是b在上,a在下<BR><BR>Call Stack在程序调试时定位错误点等方面非常有用
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:莹莹菜 回复日期:2003-09-26 15:35:25
<br>内容:知道了,谢谢!!!<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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -