自動按下 網頁 歡迎 訊息 (VB)

自動按下 網頁 歡迎 訊息 (VB)

 

Option Explicit

Dim wb As Integer
 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
      (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

Private hdoc As MSHTML.HTMLDocument ' 引用項目 Microsoft HTML Object Library

Private Sub Form_Load()

   
WebBrowser1.navigate "http://clubt.pixnet.net/blog" '會自動彈出訊息的網頁


End Sub

Private Sub Timer1_Timer()
Dim lngHwnd, lngParent
     lngHwnd = FindWindow(vbNullString, "VBScript: 您好") '尋找視窗標題
    lngParent = GetParent(lngHwnd)
    If lngHwnd > 0 Then
        SetForegroundWindow lngHwnd
        SendKeys "~"
 
    End If
   
End Sub
 

 


如有錯誤 歡迎指正