如何用oleacc获得谷歌浏览器v29的url
这个是一网友用oleacc
获得chrome 最新版本url地址,但是没给出具体的代码,网络上这方面的资料很少,哪位大侠会?
参考代码
Private Type UUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Const CHILDID_SELF As Long = 0&
Private Const OBJID_CLIENT As Long = &HFFFFFFFC
Private Declare Function AccessibleObjectFromWindow Lib "oleacc" (ByVal hWnd As Long, ByVal dwObjectID As Long, ByRef riid As UUID, ByRef ppvObject As Any) As Long
Private IID_IAccessible As UUID
Private Enum NVADIRConstants
NAVDIR_MIN
NAVDIR_UP
NAVDIR_DOWN
NAVDIR_LEFT
NAVDIR_RIGHT
NAVDIR_NEXT
NAVDIR_PREVIOUS
NAVDIR_FIRSTCHILD
NAVDIR_LASTCHILD
NAVDIR_MAX
End Enum
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim lngHWND As Long
Dim objAcc As IAccessible
lngHWND = CLng(Text1.Text)
List1.Clear
AccessibleObjectFromWindow _
lngHWND, OBJID_CLIENT, IID_IAccessible, objAcc
If objAcc Is Nothing Then
List1.AddItem "(取得失敗)"
Else
Dim child As Variant
child = objAcc.accNavigate(NAVDIR_FIRSTCHILD, CHILDID_SELF)
Do Until IsEmpty(child)
List1.AddItem objAcc.accName(child)
child = objAcc.accNavigate(NAVDIR_NEXT, child)
Loop
Set objAcc = Nothing
End If
End Sub
Private Sub Form_Initialize()
With IID_IAccessible
.Data1 = &H618736E0
.Data2 = &H3C3D
.Data3 = &H11CF
.Data4(0) = &H81
.Data4(1) = &HC
.Data4(2) = &H0
.Data4(3) = &HAA
.Data4(4) = &H0
.Data4(5) = &H38
.Data4(6) = &H9B
.Data4(7) = &H71
End With
End Sub