一旦您呼叫了 MsgBox,您正在执行的一些 Background 的处理作业,例如计数器或时钟...等,都会停下来,直到您回应了 MsgBox 之后,一切才会恢复正常!或许您并不希望如此,这也有可能造成一些不必要的错误!
要解决这个问题,您必须使用 Windows API 去呼叫 MessageBox Function,它的使用方法、外观和 MsgBox 的结果完全相同,但是它却不会中断一些 Background 的处理作业! 在以下的范例中,您要在 Form 中加入一个 Label、二个 CommandButton 及一个 Timer,不更改任何属性。 '在声明区中加入以下声明: Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long '加入以下程序码: Private Sub Command1_Click() Private Sub Command2_Click() Private Sub Form_Load() Private Sub Timer1_Timer() |
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2024-4-29 21:11 , Processed in 0.090262 second(s), 16 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.