📄 subject_54173.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,双箭头(==>>)指向如下:<BR>BOOL CGdiObject::Attach(HGDIOBJ hObject)<BR>{<BR> ==>> ASSERT(m_hObject == NULL); // only attach once, detach on destroy<BR> if (hObject == NULL)<BR> return FALSE;<BR> CHandleMap* pMap = afxMapHGDIOBJ(TRUE); // create map if not exist<BR> ASSERT(pMap != NULL);<BR> pMap->SetPermanent(m_hObject = hObject, this);<BR> 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> CRect rRect; // The rectangle of the display area<BR> int iHeight; // the heiht of the display area<BR> int iItalic = 0; // Italicize the font?<BR> // Has a font been selected?<BR> if (m_strFontList != "")<BR> {<BR> // Get the dimensions of the font sample display area<BR> m_ctlDisplayText.GetWindowRect(&rRect);<BR> // Calculate the area height<BR> iHeight = rRect.top - rRect.bottom;<BR> // Make sure the height is positive<BR> if (iHeight < 0)<BR> iHeight = 0 - iHeight;<BR> <BR> // should the font be italicized?<BR> if (m_bItalic)<BR> iItalic = 1;<BR><BR> // Release the current font<BR> <big> m_fSampFont.Detach(); 原来少了这一句</big><BR><BR> // Creat the font to be used<BR> m_fSampFont.CreateFont((iHeight - 5), 0, 0, 0, FW_NORMAL, iItalic, 0, 0, <BR> DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, <BR> DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, m_strFontList);<BR><BR> // Set the font for the sample display area<BR> m_ctlDisplayText.SetFont(&m_fSampFont);<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 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 + -