📄 自动关闭消息框.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2145
ClientLeft = 60
ClientTop = 345
ClientWidth = 6645
LinkTopic = "Form1"
ScaleHeight = 2145
ScaleWidth = 6645
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Left = 90
Top = 90
End
Begin VB.CommandButton Command1
Caption = "关闭消息框"
Height = 345
Left = 4890
TabIndex = 0
Top = 1560
Width = 1395
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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
Private Const WM_CLOSE = &H10
Private Const MsgTitle As String = "提示信息"
Private Sub Command1_Click()
Timer1.Interval = 3000
Timer1.Enabled = True
MsgBox "若您不回应的话,3 秒后此消息框将自动关闭 ! ", vbInformation, MsgTitle
End Sub
Private Sub Timer1_Timer()
Dim hWnd As Long
Timer1.Enabled = False
hWnd = FindWindow(vbNullString, MsgTitle)
SendMessage hWnd, WM_CLOSE, 0, ByVal 0&
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -