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

    How can I check for messages or "key presses" while in a loop?

    Hello,

    I'm writing a grapihcs program in MFC that runs though and does a little demo, but the user need to be able to stop the loop via hitting a key or something along those lines at any time. Any ideas? Is there some kind of API call to check for key msgs? I'm sure this is a common problem. Thank You! Rich Taylor


  2. #2
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    Re: How can I check for messages or "key presses" while in a loop?

    Write yourself a little function like this:

    void ProcessMessages()
    {
    for (MSG msg; ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); )
    {
    ::TranslateMessage(&msg);
    :ispatchMessage(&msg);
    }
    }



    And call it inside your loop.


  3. #3
    Guest

    Re: How can I check for messages or "key presses" while in a loop?

    Thank You!


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