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. Active a event while in a while loop ??

Active a event while in a while loop ??

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
5 Posts 3 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.
  • U Offline
    U Offline
    User 404410
    wrote on last edited by
    #1

    Hi, i am writing a program which produces a constant square wave form from Parallel port. I am doing this in a infinite while loop, the problem is i also want something to happen when i click a button on the dialog. How do i keep the loop runing and still be able to click a button? THANKS

    J B 2 Replies Last reply
    0
    • U User 404410

      Hi, i am writing a program which produces a constant square wave form from Parallel port. I am doing this in a infinite while loop, the problem is i also want something to happen when i click a button on the dialog. How do i keep the loop runing and still be able to click a button? THANKS

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      Check Subject below "App still works but GUI does not update when moved." Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      B 1 Reply Last reply
      0
      • J jmkhael

        Check Subject below "App still works but GUI does not update when moved." Papa while (TRUE) Papa.WillLove ( Bebe ) ;

        B Offline
        B Offline
        BadJerry
        wrote on last edited by
        #3

        Papa wrote: while (TRUE) Papa.WillLove ( Bebe ) ; Not many events in your loop!;P

        J 1 Reply Last reply
        0
        • U User 404410

          Hi, i am writing a program which produces a constant square wave form from Parallel port. I am doing this in a infinite while loop, the problem is i also want something to happen when i click a button on the dialog. How do i keep the loop runing and still be able to click a button? THANKS

          B Offline
          B Offline
          BadJerry
          wrote on last edited by
          #4

          Yes you should put your loop in a thread but if youu want something quick and dirty, call the following function (DoEvents) in your loop. BOOL DoEvents() { MSG msg; while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { return FALSE; } if (!AfxGetApp()->PreTranslateMessage(&msg)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } return TRUE; }

          1 Reply Last reply
          0
          • B BadJerry

            Papa wrote: while (TRUE) Papa.WillLove ( Bebe ) ; Not many events in your loop!;P

            J Offline
            J Offline
            jmkhael
            wrote on last edited by
            #5

            WillLove is a sum of events Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            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