Private Sub Command1_Click()MsgBox "ok"
Delay (1)SendKeys "{enter}"End Sub这段程序为什么不能自动消掉MsgBox?
Delay (1)SendKeys "{enter}"End Sub这段程序为什么不能自动消掉MsgBox?
解决方案 »
- 怎么样在当前窗口ShowWindow
- 关于webbrower表单填入的问题
- 构造类问题升级 :)
- 请问,在不连数据库时用什么样的grid控件好,(我用datagrid或者是msflexgrid不知怎么能在运行时让用户输入数据。
- 请问如何去掉EXCEL中的计算公式
- 高分急求:用ADO连接ACCESS库,如何获取库中的表名?
- 如果判断一个对象是否为nothing
- 如何,在vb里实现自动生成一个文件?
- 高手帮忙看段代码?
- 如何得到当天的日期?
- VB截取截取字符串问题
- 打开某个源码之后再打开vb6.0就出现 “正在设置Microsoft office professional edition2003”
' 新建标准 EXE工程,添加控件 Command1 、Timer1
' 编译后运行 .exe 文件!
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 LongPrivate Const MsgTitle$ = "定时消失的对话框"Private Sub Command1_Click()
Dim msg As String
If Compiled Then
With Timer1
.Interval = 3000
.Enabled = True
End With
msg = "将会消失在 3 秒后。"
Else
msg = "将会消失在 3 秒后," & vbCrLf & "必须编译后才能看见效果。"
End If
MsgBox msg, 64, MsgTitle
End SubPrivate Sub Form_Load()
Timer1.Enabled = False
Me.Caption = MsgTitle
End SubPrivate Sub Timer1_Timer()
Dim hWnd As Long
Timer1.Enabled = False
hWnd = FindWindow(vbNullString, MsgTitle)
If (hWnd) Then Call SendMessage(hWnd, &H10, 0, ByVal 0&)
End SubPrivate Function Compiled() As Boolean
On Error GoTo NotCompiled
Debug.Print 1 / 0
Compiled = True
NotCompiled:
End Function
Private Sub Command1_Click()
Timer1.Enabled = True
MsgBox "OK"
Timer1.Enabled = False
End SubPrivate Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End SubPrivate Sub Timer1_Timer()
SendKeys "{ENTER}"
End Sub