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 );