CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 23

Threaded View

  1. #13
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Snake

    Quote Originally Posted by vinayak4gargya View Post
    Breakpoint at switch (msg) of WndProc
    Step Into;
    Takes me to WM_PAINT:
    Step Into : hdc = BeginPaint(hwnd,&ps);
    Step Into again : I am returned back to switch(msg) (??) (The rest of the code of WM_PAINT is not executed)(??)
    You must be careful when debugging WM_PAINT messages.

    You cannot debug them if you have the debugger popup over your window. The reason is obvious -- each time the debugger is closed, your app window has to be repainted, causing another WM_PAINT message to be generated and the breakpoint is hit again. Then you continue the program, causing the app window to be exposed, meaning another WM_PAINT message is generated, which hits the breakpoint, then etc. etc. etc. You are basically in a "debugging" infinite loop of breakpoint, WM_PAINT, show app window, breakpoint, WM_PAINT, show app window, ...

    The way you debug WM_PAINT messages is either

    1) Make sure your Visual Studio debugger window does not intersect anyway with your main app window. This means that you have to resize your app and/or Visual Studio IDE window so that they do not overlap each other.

    OR

    2) You have a dual monitor setup, where your app is on one monitor, and your Visual Studio IDE is on the other monitor.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; December 27th, 2010 at 10:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured