- 帖子
- 23
- 主題
- 0
- 精華
- 0
- 積分
- 73
- 點名
- 90
- 作業系統
- XP
- 軟體版本
- Office 2003
- 閱讀權限
- 20
- 註冊時間
- 2012-4-21
- 最後登錄
- 2025-4-13
           
|
9#
發表於 2015-7-24 00:55
| 只看該作者
- Option Explicit
- #If Win64 = 1 Then
- Private Declare PtrSafe Function GetWindow Lib "user32" (ByVal HWND As Long, ByVal wCmd As Long) As Long
- Private Declare PtrSafe Function SetForegroundWindow Lib "user32" (ByVal HWND As Long) As Long
- #Else
- Private Declare Function GetWindow Lib "user32" (ByVal HWND As Long, ByVal wCmd As Long) As Long
- Private Declare Function SetForegroundWindow Lib "user32" (ByVal HWND As Long) As Long
- #End If
- Private Const GW_HWNDNEXT = 2
- Private Const GW_CHILD = 5
- Sub ex()
- Dim lHwndChild&
-
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "https://dl.dropboxusercontent.com/u/40393708/test1.htm"
- Do While .Busy Or .ReadyState <> 4
- DoEvents
- If 3 = .ReadyState Then
- lHwndChild = GetWindow(.HWND, GW_CHILD)
- Do While lHwndChild
- SetForegroundWindow .HWND 'HWND is the HWND of the myIEWindow
- Application.SendKeys "~", True
- lHwndChild = GetWindow(lHwndChild, GW_HWNDNEXT)
- Loop
- End If
- Loop
- End With
-
- End Sub
複製代碼 回復 8# joey0415 |
|