Pause a program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KewinT
    Registered User
    • Aug 2006
    • 3

    #1

    Pause a program

    "I need to call a function every 1 second in my Windows (GUI) program. I have tried the following:


    Code:
    #include <windows.h>
    ...
    while (true) {
    Sleep(1000);
    }This works, except it locks up the application between calls so nothing else can occur.

    Does C++ (or the Windows API) have a built-in pause or timer function for this purpose? Thanks."
    Content hosting - Fixed rate loans
  • FuqALot
    Confirmed User
    • Dec 2001
    • 3817

    #2
    You need to execute a process message - you need to add a line in the while loop - telling the program to process all new input, so that it won't hang.

    I have no idea how to do it in C++, in Delphi I would add: Application.Processmessages; -- I googled it and maybe you should try to add the following in the while loop: Application->ProcessMessages();

    Comment

    • free4porn
      Confirmed User
      • Jun 2005
      • 4654

      #3
      bump for help
      Switch To Fling Now! I'm on 1:201 paid signups sending little traffic! Make $$$
      Free Porn

      Comment

      • XMaster
        Poker Player
        • Jul 2003
        • 2945

        #4
        please DO NOT post biz thread on GFY.

        Thank you.
        still moneyhere

        Comment

        Working...