Click here to Skip to main content
15,889,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Updated 3-Jun-12 19:16pm
v3
Comments
Sergey Alexandrovich Kryukov 3-Jun-12 23:36pm    
Not clear. "will halt at the breakpoint" and "I have to force to stop it" are mutually exclusive. You probably did not explain what happens properly. What does it mean "with no response"? The stopping at the breakpoint it all that should happen. If possible, use "Improve question" above.
--SA

You're either setting the window to be top most or have a system modal dialog open.
 
Share this answer
 
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.
 
Share this answer
 
v2
Comments
xiaohangge 4-Jun-12 5:58am    
thanks,The description of my problem is unclear.i mean the mouse event only indicate the buttondown event."the interface always lie in top-most",it mean the procedure result interface,not the Visual Studio interface.'the procedure has no response'means that at breakpoint it can't return to breakpoint codes and the interface always lie in top-most.that the procedure dies maybe expain "the procedure has no response" clear.
Stefan_Lang 4-Jun-12 6:30am    
I am not sure I understand you. But you said you break at buttondown event.

One idea is: set breakpoint for buttonup event, not buttondown. When you click (press the left mouse button) on a button in a dialog, nothing will happen. The function will only be triggered when you release the mouse button again! Maybe your program or Visual Studio gets confused because it breaks between buttondown and buttonup?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900