CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    71

    Funktion use every 2 minutes (in a kind of loop) ? IMPORTAND ;]

    How can do a kind like >while (timer = twominutes); {my func}< without the tool (the rest of the programm) stand still ??

    I heared about a CreateWaitTimer() but dont know to handle - or will be very happy about an example !!


  2. #2
    Join Date
    May 1999
    Posts
    128

    Re: Funktion use every 2 minutes (in a kind of loop) ? IMPORTAND ;]

    use WM_TIMER message, like this...


    // call this function to start the timer
    void CSomeClass::OnTimerStart()
    {
    if (m_uTimerID)
    return; // timer already running
    m_uTimerID = SetTimer(1, 2 * 60 * 1000, NULL); // set timer for 2 mins.
    }
    // call this to stop it
    void CSomeClass::OnTimerStop()
    {
    if (m_uTimerID)
    KillTimer(m_uTimerID);
    m_uTimerID = 0;
    }
    // this is the handler for WM_TIMER message, it will
    // be called every 2 mins.
    void CSomeClass::OnTimer(UINT nIDEvent)
    {
    // do something...
    }





  3. #3
    Join Date
    May 1999
    Posts
    71

    Re: Funktion use every 2 minutes (in a kind of loop) ? IMPORTAND ;]

    Thaks alot hope it works transparent ! =) (Ill check it out now)


  4. #4
    Join Date
    May 1999
    Posts
    71

    Re: Funktion use every 2 minutes (in a kind of loop) ? IMPORTAND ;]

    I cant figure it out how to handle

    Ive put your code in the xxFrame.cpp

    and do the following ind xxFrame.h:

    class CNuCFrame : public CStatic
    {
    public:
    void OnTimerStart();
    void OnTimerStop();
    void OnTimer(UINT nIDEvent);


    but I guess I miss somethink - cause nothink happend =)

    could u help me again ? Or if u like an example project will be very nice !!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured