Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DoEvents Equiv in VC++

DoEvents Equiv in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nick Jacobs
    wrote on last edited by
    #1

    Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick

    C N J 3 Replies Last reply
    0
    • N Nick Jacobs

      Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      To refresh the screen, call Invalidate(). To respond to events while in a loop you should really have a UI thread and a worker thread. Otherwise the loop will stop the GUI from responding. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

      Sonork ID 100.10002:MeanManOz

      I live in Bob's HungOut now

      1 Reply Last reply
      0
      • N Nick Jacobs

        Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        while (GetMessage(&msg, NULL, 0, 0))
        {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        }

        Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

        1 Reply Last reply
        0
        • N Nick Jacobs

          Ok, it's 11:00pm and I've been slinging code in front of this puter all day. What I can't remember is, what's the equivalent of a DoEvents for VC? What I need to do is to have the display refresh and respond to events while in a loop. VB uses DoEvents to do this. Just can't think this late at night. Anybody wanna bail me out? Thanks, Nick

          J Offline
          J Offline
          Jens Kreiensiek
          wrote on last edited by
          #4

          the mfc-way:

          void DoEvents()
          {
          MSG m;
          while(::PeekMessage(&m, 0, 0, 0, PM_NOREMOVE))
          AfxGetApp()->PumpMessage();

          LONG lIdle = 0;
          while(AfxGetApp()->OnIdle(lIdle++ ))
          	;  
          

          }

          have fun... jk :cool:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups