Web refreshler

xiaoxiao2021-03-06  19

Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As LongPrivate Declare Function GetWindowText Lib "user32" Alias ​​"GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function GetWindowTextLength Lib "User32" Alias ​​"getWindowTextLengtha" (Byval Hwnd As Long) As long

Private const gw_hwndlast = 1Private const gw_hwndnext = 2

Function GetWin (webadd As String) As String On Error Resume Next Dim NhWnd As Long Dim Length, WinTitle $ Dim OkWin As String NhWnd = GetWindow (hwnd, GW_HWNDFIRST) While NhWnd <> 0 Length = GetWindowTextLength (NhWnd) WinTitle $ = Space $ (Length 1) Length = getWindowText (NHWND, WINTITLE $, Length 1) if IF INSTR (Lcase (Wintitle $), WebAdd> 0 Then Okwin = Okwin & "//" & nhwnd end if nhwnd = getWindow (nhwnd, GW_HWNDNEXT) WEND GETWIN = OKWINEND FUNCTION

Sub sendInfo (WebAddr As String) ON Error ResMe Next Dim Okwin, hcount okwin = getwin (WebAddr) 'msgbox okwin if len (okwin)> 0 Then Okwin = split (okwin, "//") for hcount = 0 to Ubound Okwin)> 0 Then 'msgbox okwin (hcount)' msgbox getwinname (okwin (hcount)) Appactivate getwinname (okwin (hcount)) sendKeys "{f5}" end if next end fnd SUB

Function GetWinName (ByVal WinID As Long) As String On Error Resume Next If WinID <1 Then Exit Function Dim Length, WinTitle $ Length = GetWindowTextLength (WinID) WinTitle $ = Space $ (Length 1) Length = GetWindowText (WinID, WinTitle $ Length 1) getwinname = Wintitle $ END FUNCTIONPRIVATE SUB Command1_Click () if text1.text = "or text2.text =" "The msgbox" Input Not ", Vbcritical," Tips "EXIT SUB End if Timer1.enabled = True Timer1.interval = val (text2.text) * 500 Command1.enabled = false command2.enabled = true text1.enabled = false text2.enabled = falseeend submmand2.enable

Private submmand2_click () Timer1.enabled = false command1.enabled = true command2.enabled = false text1.enabled = true text2.enabled = truend submmand2.enabled = true text2.enable

PRIVATE SUB FORM_LOAD () Command1.enabled = true command2.enabled = falsend sub

Private sub timer1_timer () on error resume next call sendinfo (text1.text) End Sub

转载请注明原文地址:https://www.9cbs.com/read-56613.html

New Post(0)