Thread: How do you use TIMERPROC?

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    162

    Question How do you use TIMERPROC?

    With the SetTimer function, I am trying to use the forth argument to call a function when the timer delay has gone by. In the Windows reference it says this about the fourth argument:
    TIMERPROC lpTimerFunc // address of timer procedure

    lpTimerFunc

    Points to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc.
    If lpTimerFunc is NULL, the system posts a WM_TIMER message to the application queue. The hwnd member of the message’s MSG structure contains the value of the hWnd parameter.
    Can somebody show me how to work this? Thank you!

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Create a callback -

    VOID CALLBACK YourTimer( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
    {
    //this will be called when a timer event happens
    //place your code here
    }


    Then call SetTimer() with the name of the above function(it's pointer) as the fourth parameter.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetTimer() doesn't behave.
    By OnionKnight in forum Windows Programming
    Replies: 9
    Last Post: 04-09-2007, 03:52 PM