Option Explicit
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub main()
Dim lHwnd As Long
Call Shell(App.Path & "\QQ记牌器全集.exe", vbNormalFocus)
superSleep (1)
lHwnd = FindWindow(vbNullString, "勇芳收费软件登入") '还得等等QQ记牌器全集启动阿,太慢了
Do While lHwnd <> 0
If GetForegroundWindow <> lHwnd Then
Call SetForegroundWindow(lHwnd)
End If
Call SendKeys("{ENTER}") '发现没有,勇芳登陆程序预留了Enter缺省命令按钮,^-^,一阵狂笑
superSleep (1) '发送回车不能太快,要像花形一样的柔性
lHwnd = FindWindow(vbNullString, "勇芳收费软件登入")
Loop
lHwnd = FindWindow(vbNullString, "勇芳广告") '查找广告窗口
If lHwnd <> 0 Then
Call PostMessage(lHwnd, WM_CLOSE, 0&, 0&) '关闭广告窗口
End If
End Sub
'*************************************************************************
'**函 数 名: superSleep
'**输 入: DealyTime(Long) 需延时的时间
'**输 出: 无
'**功能描述: 延时器无凝滞
'**作 者: Mr.David
'**日 期: 2007-04-04 13:35:39
'**版 本: V1.0.0
'*************************************************************************
Public Function superSleep(DealyTime As Long)
Dim TimerCount As Single
TimerCount = Timer + DealyTime '增加X秒
While TimerCount - Timer > 0
DoEvents
Sleep (1)
Wend
End Function