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

Thread: How to debug Win32 Message Loop?

  1. #1
    Join Date
    Dec 2010
    Posts
    907

    How to debug Win32 Message Loop?

    You place a breakpoint at one of locations within the message loop.
    But I want the breakpoint to trigger when I click on the application window, for example.
    But I can't, it went so fast so long as I switch from VS to the application program,
    the breakpoint is hitted again, then the application is frozen again.
    I don't know how to setup a conditional breakpoint. Any pointers please?
    Any ideas?
    Thanks
    Jack
    Last edited by lucky6969b; September 28th, 2014 at 11:51 PM.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: How to debug Win32 Message Loop?

    MS recommends remote debugging for GUI drawing and message queue issues.
    Best regards,
    Igor

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: How to debug Win32 Message Loop?

    Quote Originally Posted by lucky6969b View Post
    You place a breakpoint at one of locations within the message loop.
    But I want the breakpoint to trigger when I click on the application window, for example.
    I highly recommend you use a dual monitor for debugging GUI issues, where Visual Studio is on one monitor, and your application is on the other monitor. Or get a very large monitor and position/resize Visual Studio's window so that it doesn't overlap your application's window.

    By doing this, you don't get the chicken/egg scenario of hitting your breakpoint over and over again when you merely switch from application to Visual Studio.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,207

    Re: How to debug Win32 Message Loop?

    Beside that is already answered

    You can put a conditional breakpoint in the message loop, e.g. having the condition msg.message == 0x0201, where 0x0201 is the value of WM_LBUTTONDOWN.
    However, it's more handy and practical to put an ordinary breakpoint in the WM_LBUTTONDOWN message handler.
    Last edited by ovidiucucu; October 1st, 2014 at 06:35 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: http://codexpert.ro/blog/author/ovidiu-cucu/

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)