Once you have called MsgBox, you are performing some of the Background processing jobs, such as counters or clocks ... And so on, will stop, until you respond to the MsgBox, everything will return to normal! Perhaps you do not want this, it may also cause some unnecessary mistakes!
To resolve this problem, you must use the Windows API to call the MessageBox Function, which uses the same methods, looks, and MsgBox results, but it does not interrupt some Background processing jobs!
In the following example, you add a Label, two CommandButton, and a Timer to the Form without changing any properties.
' Add the following declaration to the declaration area:
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd as Long, ByVal Lptext as String, ByVal LP Caption as String, ByVal wtype as Long
' Add the following program code:
Private Sub Command1_Click ()
MsgBox "Timer's stopped!" ",", "VB message box"
End Sub
Private Sub Command2_Click ()
MessageBox Me.hwnd, "Note!" The timer's still running! "," API message box ", 64
End Sub
Private Sub Form_Load ()
Me.TimerInterval = 1000
Label1.Caption = "The current time is:" & Times
End Sub
Private Sub Timer1_timer ()
Label1.Caption = "The current time is:" & Times
End Sub