3 usage of the WIN32 API timer

Source: Internet
Author: User

1.SetTimer (Hwnd,uint,uint,timerproc); The first parameter is set to capture the window handle of the timed message, the second parameter is the timer's ID, the third is the timing length in milliseconds, the last parameter is set to NULL, You can make the window's callback function handle the WM_TIMER message. In general, the SetTimer call is made when the window is created, and the wm_timer response is added to the callback function. Then the window is destroyed when the timer is destroyed: KillTimer (hwnd,uint), the parameters are window handle and timer ID respectively.

2.SetTimer (Hwnd,uint,uint,timerproc); the only difference from the first method is that the last parameter is not NULL, but rather a callback function that is defined by itself, so that the WM_TIMER message is fetched and processed by its own defined callback function. The same should be done at the end of the use of KillTimer (Hwnd,uint);

3.IDtimer = SetTimer (Hwnd,uint,uint,timerproc); Set the first parameter to NULL, the second parameter to 0, and the third and fourth parameters in line with the second method, so that creating a timer returns a timer ID. Called KillTimer (Null,idtimer) when the timer is destroyed. This method is suitable for many times the timing is easy to confuse the timer ID of the program, because its return value management Timer ID, and do not manage

3 usage of the WIN32 API timer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.