在VB中如何做到使一个msgbox的提示信息只弹出来0.5秒(大概)的时间就自动消失呢?
请哪位高手能简单的说下部分代码!我想应该用到timer控件,注意是一定是自动消失,不用人点的(注:程序的其它的什么返回信息什么的,不用过多的考虑,我自己再弄)...
请哪位高手能简单的说下部分代码!
我想应该用到timer控件,注意是一定是自动消失,不用人点的
(注:程序的其它的什么返回信息什么的,不用过多的考虑,我自己再弄) 展开
我想应该用到timer控件,注意是一定是自动消失,不用人点的
(注:程序的其它的什么返回信息什么的,不用过多的考虑,我自己再弄) 展开
展开全部
'本代码要测试时请先编译成 .exe 再试
'添加 Command1 Timer1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Const MsgTitle As String = "Test Message"
Dim Rtn&, hwnd&
Private Sub Command1_Click()
Timer1.Interval = 3000
Timer1.Enabled = True
Rtn = MsgBox("若您不回应的话,3 秒后此 MsgBox 会自动关闭", 64, MsgTitle)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
hwnd = FindWindow(vbNullString, MsgTitle)
Call SendMessage(hwnd, WM_CLOSE, 0, ByVal 0&)
End Sub
'添加 Command1 Timer1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Const MsgTitle As String = "Test Message"
Dim Rtn&, hwnd&
Private Sub Command1_Click()
Timer1.Interval = 3000
Timer1.Enabled = True
Rtn = MsgBox("若您不回应的话,3 秒后此 MsgBox 会自动关闭", 64, MsgTitle)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
hwnd = FindWindow(vbNullString, MsgTitle)
Call SendMessage(hwnd, WM_CLOSE, 0, ByVal 0&)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以用添加一个窗体做的像MsgBox 再在上面放一个Timer就OK啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询