-
Notifications
You must be signed in to change notification settings - Fork 3
/
iuiautomationlegacyiaccessiblepattern.go
71 lines (62 loc) · 2.15 KB
/
iuiautomationlegacyiaccessiblepattern.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// +build windows
package windows_accesibility_features
import (
"syscall"
"unsafe"
"github.com/go-ole/go-ole"
)
type IUIAutomationLegacyIAccessiblePattern struct {
ole.IUnknown
}
type IUIAutomationLegacyIAccessiblePatternVtbl struct {
ole.IUnknownVtbl
DoDefaultAction uintptr
Get_CachedChildId uintptr
SetValue uintptr
Get_CachedDefaultAction uintptr
Get_CachedDescription uintptr
Get_CachedHelp uintptr
Get_CachedKeyboardShortcut uintptr
Get_CachedName uintptr
Get_CachedRole uintptr
Get_CachedState uintptr
Get_CachedValue uintptr
Get_CurrentChildId uintptr
Get_CurrentDefaultAction uintptr
Get_CurrentDescription uintptr
Get_CurrentHelp uintptr
Get_CurrentKeyboardShortcut uintptr
Get_CurrentName uintptr
Get_CurrentRole uintptr
Get_CurrentState uintptr
Get_CurrentValue uintptr
GetCachedSelection uintptr
GetCurrentSelection uintptr
GetIAccessible uintptr
Select uintptr
}
// https://github.com/mmarquee/ui-automation/blob/ec43c1449b11b5d0f3fd313367e242c6ce456bd9/src/main/java/mmarquee/uiautomation/IUIAutomationLegacyIAccessiblePattern.java
var IID_IUIAutomationLegacyIAccessiblePattern = &ole.GUID{0x828055ad, 0x355b, 0x4435, [8]byte{0x86, 0xd5, 0x3b, 0x51, 0xc1, 0x4a, 0x9b, 0x1b}}
func (pat *IUIAutomationLegacyIAccessiblePattern) VTable() *IUIAutomationLegacyIAccessiblePatternVtbl {
return (*IUIAutomationLegacyIAccessiblePatternVtbl)(unsafe.Pointer(pat.RawVTable))
}
// https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-setvalue
// HRESULT SetValue(
// LPCWSTR szValue
// );
func (pat *IUIAutomationLegacyIAccessiblePattern) SetValue(value string) error {
szValue, err := syscall.UTF16PtrFromString(value)
if err != nil {
return err
}
hr, _, _ := syscall.Syscall(
pat.VTable().SetValue,
2,
uintptr(unsafe.Pointer(pat)),
uintptr(unsafe.Pointer(szValue)),
0)
if hr != 0 {
return ole.NewError(hr)
}
return nil
}