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. Do Other Processing (GUI Loop)

Do Other Processing (GUI Loop)

Scheduled Pinned Locked Moved C / C++ / MFC
csharpdelphivisual-studioquestion
2 Posts 2 Posters 0 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.
  • G Offline
    G Offline
    Grahamfff
    wrote on last edited by
    #1

    I know in Borland their is a command to check for other events when in a loop on a form. Are they something the same in Visual Studio. I am in a loop when I click a button, but need to check if another button/checkbox event needs to be processed; e.g. flag set to exit the loop. Or do I need to opt for a worker thread? Graham. grahamfff

    P 1 Reply Last reply
    0
    • G Grahamfff

      I know in Borland their is a command to check for other events when in a loop on a form. Are they something the same in Visual Studio. I am in a loop when I click a button, but need to check if another button/checkbox event needs to be processed; e.g. flag set to exit the loop. Or do I need to opt for a worker thread? Graham. grahamfff

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      Putting your loop in a worker thread is usually the best way. Otherwise you have to check the message queue at regular intervals in your loop so that the GUI can handle the messages. If you are using MFC then a call to AfxGetApp()->PumpMessage() will do the trick. If not using MFC then you have to place calls to PeekMessage, TranslateMessage, and DispatchMessage. See http://www.codeproject.com/threads/usingworkerthreads.asp[^].


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

      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