Skip to content

Instantly share code, notes, and snippets.

Created May 30, 2014
What would you like to do?
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Declare PtrSafe _
Function IUnknown_QueryService Lib "shlwapi.dll" ( _
ByVal punk As IUnknown, _
guidService As GUID, _
riid As GUID, _
ppvOut As IAccessible _
) As Long
Sub hoge()
Dim IID_IAccessible As GUID
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
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate ""
While ie.busy Or ie.ReadyState <> 4
Dim cmb As MSHTML.IHTMLSelectElement
Set cmb = ie.document.all("kamoku2")
'cmb.selectedIndex = 1
Dim hr As Long
Dim pElement As MSHTML.IHTMLElement
Set pElement = cmb
Dim acc As IAccessible
hr = IUnknown_QueryService(pElement, IID_IAccessible, IID_IAccessible, acc)
'Debug.Print acc Is Nothing, Hex(hr)
If hr < 0 Then Exit Sub
'Debug.Print acc.accChildCount
acc.accDoDefaultAction 2&
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment