Click here to Skip to main content
12,300,379 members (39,532 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VC7 C++
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 3-Jun-12 17:21pm
Edited 3-Jun-12 19:16pm
v3
Comments
SAKryukov 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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You're either setting the window to be top most or have a system modal dialog open.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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. Wink | ;)

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.
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 4 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100