关于断点 [英] about the breakpoint

查看:56
本文介绍了关于断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs2005中使用MFC框架编写一些代码,并在鼠标事件响应函数中插入一个断点,然后在运行并敲击鼠标时,该过程将在该断点处停止,并且该接口始终位于最顶层,无论我这样做了,但是该程序没有响应,我不得不强行停止它.如果在没有断点的情况下运行,该程序将运行良好.为什么?

I write some codes using MFC frame in vs2005,and I insert a breakpoint in mouse event response function ,then when running and hitting the mouse, the procedure will stop at the breakpoint and the interface always lie in top-most ,whatever i do,and the procedure has no response,and I have to stop it by force. If running without a breakpoint ,the procedure runs well. why? where is error?

推荐答案

您正在将窗口设置为最顶部,或者打开了系统模式对话框.
You''re either setting the window to be top most or have a system modal dialog open.


您的问题的描述还不清楚.就是说,在 general 鼠标事件处理程序中设置一个断点可能是一个非常糟糕的主意(如果那是您的工作?). IIRC会捕获所有鼠标事件,包括鼠标移动-因此,只要您的手触摸鼠标,您几乎就会不断收到事件(除非您保持鼠标静止不动...)

相反,请始终在特定于 的处理程序中设置断点,例如e. G. ButtonUp或ButtonPress.

另外,您可以尝试使用[F5]来启动或继续调试,而不是使用鼠标单击工具栏按钮:如果您不触摸鼠标,则很有可能您不会立即引起另一个鼠标事件,触发断点. ;)

邮编:
当您说界面始终位于最顶层时,我怀疑您的意思是Visual Studio?如果您遇到断点,它将始终被带到顶部,这很正常.然后,您说该程序无响应".我一开始并不了解,但是如果您引用自己的程序,那也很正常:程序遇到断点时,它会被中断,并且不会响应任何交互!请记住,处理用户交互是程序的一部分,如果您用断点暂停它,那么该处理也将被暂停.您始终可以按[F5]或单击工具栏上的相应按钮以继续执行您的应用程序.
The description of your problem is rather unclear. That said, setting a breakpoint inside the general mouse event handler may have been a very bad idea (if that is what you did?). IIRC it catches all mouse event, including mouse movement - as a result you''ll pretty much keep getting events as long as your hand touches the mouse (unless you''re keeping it very still...)

Instead, always set the breakpoints inside the specific handlers, e. g. ButtonUp, or ButtonPress.

Also, you could try to use [F5] to start or continue debugging instead of using the mouse to click the toolbar button: if you don''t touch the mouse, then chances are high you won''t immediately cause another mouse event, triggering a breakpoint. ;)

P.S.:
When you said ''the interface always lie in top-most, I suspect you mean Visual Studio? If you hit a breakpoint, it will always be brought to the top, so that''s normal. You then said ''the procedure has no response''. I didn''t understand that at first, but if you refer to your own program, then this is normal, too: The moment your program hits a breakpoint, it is interrupted and will not respond to any interaction! Remember that processing user interaction is part of your program, and if you pause it with a breakpoint, then this processing will be paused, too. You can always press [F5] or click the corresponding button on the toolbar to continue exection of your application.


这篇关于关于断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆