It is a bit inexplicable to see the 9CBS for a long time, and the bottom is the example program.
'This button initial title is "Process". All instances of the private submmand1_click () 'process' share static variables. STATIC BLNPROCESSING AS BOOLEAN DIM LNGCT AS Long DIM INTYIELDCT AS INTEGER DIM DBLDUMMY AS DOUBLE 'When the button is pressed, it is detected. If BLNPROCESSING THEN 'is being processed, cancel processing. BLNPROCESSING = false else command1.caption = "CANCEL" BLNPROCESSING = true LNGCT = 0 'Performs a million floating point' multiplication calculation. After each thousand times, 'Detection is to be canceled. Do While BLNPROCESSING AND (LNGCT <1000000) for intYieldct = 1 to 1000 LNGCT = LNGCT 1 DBLDUMMY = LNGCT * 3.14159 Next INTYIELDCT 'DOEVENTS statement allows other event' to occur, including the second 'Press this button. Doevents loop blnprocessing = false command1.caption = "process" msgbox lngct & "multiplications were performed" end if End Sub
Later, I was finally understood again, but it is actually to prevent the program from running a long-term process or function.
Stop the response, let it stop from time to time to see what other events happen to respond to the event.
Preventing like we often see some programs showing "no response" words, that case