The first article, a simple Timer

Source: Internet
Author: User

I tried to use the timer. I found a small tutorial on the Internet to write a simple timer.

The timer interface is shown in:

Three processing functions are added, including the processing functions of two buttons and the processing functions of one timer, as shown in:

A variable is added to the text box for counting and displaying:

The code for the added three processing functions is as follows:

View code

Void ctest020902dlg: ontimer (uint nidevent)
{
// Todo: add your message handler code here and/or call default
M_edit1 + = 1;
Updatedata (false );
Cdialog: ontimer (nidevent );
}

Void ctest020902dlg: onbuttonstart ()
{
// Todo: add your control notification handler code here
Settimer (1,100, null );
}

Void ctest020902dlg: onbuttonstop ()
{
// Todo: add your control notification handler code here
Killtimer (1 );
}

 

The role of the following statement is to delay the program by 0.1 s. Click it to start timing and run the timer processing function once every seconds.

Settimer (1,100, null );

 

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.