Post · 2009-11-24 11:58

[vba]auto click alert

作者Tony1223.bbs@aurora.mis.yzu.edu.tw (沉默是金)
標題[vba]auto click alert
時間北極光 (2009/11/24 Tue 11:37:27)
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Declare Sub Sleep Lib "kernel32" (ByVal dwMS As Long)
Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long '結數計時器函數
Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Sub StartAsub()
SetTimer Application.hWnd, 1, 500, AddressOf test
End Sub
Sub StopAsub()
KillTimer Application.hWnd, 1
End Sub
Sub test()
lIndex = FindWindow("#32770", "Windows Internet Explorer")
'if one is found the sendmessage clicks the ok button
If Not lIndex = 0 Then
SendMessage FindWindowEx(lIndex, 0, "Button", "確定"), &HF5, 0, 0
End If
lIndex = FindWindow("#32770", "檔案下載")
'if one is found the sendmessage clicks the ok button
If Not lIndex = 0 Then
SendMessage FindWindowEx(lIndex, 0, "Button", "開啟舊檔(&O)"), &HF5, 0, 0
End If
End Sub
--
▄▅▆▇███▇▆▅▄▃ ╰┼╯─╮ ╮
◥███████████◣ ╰┼╯=│=│
◥██████───────◣ *.╯ ╯ ╯ の物語.*
◥███████──────◣~◢◣ ◢◣
◥██████───────◤ ◥◤* 空白的世界.翼 *◥◤
◥██▁▂▃▄▅▆▇███▆▅▄▃▂▂~telnet://tony1223.no-ip.info
--
╭═ Origin ─═ 北極光 aurora.twbbs.org κλμ ─╣
╚─ Author ═─ 114-136-206-141.dynamic.h
Replies
0
Likes
0
Reposts
0

Comments

No approved comments yet.