Greetings everyone! Can you help me with SetInterval()?

This is a discussion on Greetings everyone! Can you help me with SetInterval()? within the C++ Programming forums, part of the General Programming Boards category; I want to make a function to run each 60 seconds. I have this: setInterval(MainWindow::newIdentity,60*1000); The function is MainWindow::newIdentity and ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    52

    Greetings everyone! Can you help me with SetInterval()?

    I want to make a function to run each 60 seconds.

    I have this:

    setInterval(MainWindow::newIdentity,60*1000);

    The function is MainWindow::newIdentity and the time is 60 seconds.
    He says it doesnt know the function setInterval. What should I do or include to the file for he to know it?


    Thanks!

  2. #2
    Registered User
    Join Date
    May 2008
    Posts
    52
    Quote Originally Posted by manav View Post
    Try SetInterval please.
    Gives the same error.

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    If you need a reference for SetInterval, you can start with MSDN.

    The function is MainWindow::newIdentity
    That doesn't look like a function!

    Maybe something like this? MainWindow::newIdentity(). That assumes newIdentity doesn't require any paramaters inside those parentheses... I don't know...

    And, the function-name needs to be a string inside quotes.

    Try this:
    SetInterval("MainWindow::newIdentity()", 60000);

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,920
    What kind of code/language is this?
    I don't recall "X::Y" existing in Javascript, or does it?
    And there's certainly no function named setInterval in C++ either, unless I missed that one.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    looks like perl or PHP...

  6. #6
    Super unModrator
    Join Date
    Dec 2007
    Posts
    321
    manav, your function opened two windows now how do I close them? I click "Ok" but they are not closing.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,920
    I think you'll just have to terminate the the process.
    Last edited by Elysia; 05-22-2008 at 06:34 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Super unModrator
    Join Date
    Dec 2007
    Posts
    321
    And what is the procedure to close them? I just lost my 10 open tabs (though they are still in the history)

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,920
    It keeps re-opening one alert after another until you stop the timer.
    (abh!shek - best use a tab manager such as Tab Mix Plus or get FF3.)
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Super unModrator
    Join Date
    Dec 2007
    Posts
    321
    (abh!shek - best use a tab manager such as Tab Mix Plus or get FF3.)
    Why FF3? I have the latest stable version 2.0.0.14 Anything special in FF3?

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,920
    Quote Originally Posted by manav View Post
    i put void(0); at the end for ending it after alert().
    you can change setInterval() with setTimer.
    Obviously it isn't working. If you need just one timer, just use setTimeout instead.

    Quote Originally Posted by abh!shek View Post
    Why FF3? I have the latest stable version 2.0.0.14 Anything special in FF3?
    FF3 has a crash recovery. If the browser crashes, it restores that tabs from your last session, among other things.
    The latest is FF3 RC1. It's pretty stable (still running FF3B5, though; waiting for extensions to be compatible).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21