Results 1 to 3 of 3

Thread: SetTimer/KillTimer

  1. #1

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    I am having a problem killing a timer I have set

    I set the timer with:
    Code:
    m_TimerID = SetTimer(m_hWnd,1,5000,(TIMERPROC)TimerProc);
    And I have tried both of the following to kill the timer
    Code:
    BOOL ret;
    
    ret = KillTimer(m_hWnd,1);
    ret = KillTimer(m_hWnd,m_TimerID);
    Neither one seems to kill the timer, and the both return false. Any ideas on what I am doing wrong or how to kill the timer?

    Thanks
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    According to MS this should work:

    Code:
    ret = KillTimer(NULL, m_TimerID);
    Where m_TimerID is the Timer ID you received from the SetTimer function

    Or

    Code:
    ret = KillTimer(m_hWnd,1);
    Where 1 is the Timer ID (I see you use 1 in the SetTimer too)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    I figured it out. My window handle was no inited yet so it was 0x00000000 in the SetTimer function and 0x0000da16 in the KillTimer. So I just set the kill and set to the same handle and it works now. Thanks for the help.
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


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