forked from hnakamur/w32uiautomation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
iuiautomationcacherequest.go
105 lines (90 loc) · 2.89 KB
/
iuiautomationcacherequest.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package w32uiautomation
import (
"syscall"
"unsafe"
"github.com/go-ole/go-ole"
)
type IUIAutomationCacheRequest struct {
ole.IUnknown
}
type IUIAutomationCacheRequestVtbl struct {
ole.IUnknownVtbl
AddPattern uintptr
AddProperty uintptr
Clone uintptr
Get_AutomationElementMode uintptr
Get_TreeFilter uintptr
Get_TreeScope uintptr
Put_AutomationElementMode uintptr
Put_TreeFilter uintptr
Put_TreeScope uintptr
}
var IID_IUIAutomationCacheRequest = &ole.GUID{0xb32a92b5, 0xbc25, 0x4078, [8]byte{0x9c, 0x08, 0xd7, 0xee, 0x95, 0xc4, 0x8e, 0x03}}
func (cacheRequet *IUIAutomationCacheRequest) VTable() *IUIAutomationCacheRequestVtbl {
return (*IUIAutomationCacheRequestVtbl)(unsafe.Pointer(cacheRequet.RawVTable))
}
// AddPattern
//
// @Description: Adds a control pattern to the cache request.
// @receiver cacheRequet
// @param patternId
// @return err
func (cacheRequet *IUIAutomationCacheRequest) AddPattern(patternId PATTERNID) (err error) {
return addPattern(cacheRequet, patternId)
}
// AddProperty
//
// @Description: Adds a property to the cache request.
// @receiver cacheRequet
// @param propertyId
// @return err
func (cacheRequet *IUIAutomationCacheRequest) AddProperty(propertyId PROPERTYID) (err error) {
return addProperty(cacheRequet, propertyId)
}
// GetTreeScope
//
// @Description: Specifies the scope of caching.
// @receiver cacheRequet
// @return scope
// @return err
func (cacheRequet *IUIAutomationCacheRequest) GetTreeScope() (scope TreeScope, err error) {
return getTreeScope(cacheRequet)
}
// PutTreeScope
//
// @Description: Specifies the scope of caching.
// @receiver cacheRequet
// @param scope
// @return err
func (cacheRequet *IUIAutomationCacheRequest) PutTreeScope(scope TreeScope) (err error) {
return putTreeScope(cacheRequet, scope)
}
func putTreeScope(cacheRequest *IUIAutomationCacheRequest, scope TreeScope) (err error) {
hr, _, _ := syscall.SyscallN(cacheRequest.VTable().Put_TreeScope, uintptr(unsafe.Pointer(cacheRequest)), uintptr(scope))
if hr != 0 {
err = ole.NewError(hr)
}
return
}
func getTreeScope(cacheRequest *IUIAutomationCacheRequest) (scope TreeScope, err error) {
hr, _, _ := syscall.SyscallN(cacheRequest.VTable().Get_TreeScope, uintptr(unsafe.Pointer(cacheRequest)), uintptr(scope))
if hr != 0 {
err = ole.NewError(hr)
}
return
}
func addPattern(cacheRequest *IUIAutomationCacheRequest, patternId PATTERNID) (err error) {
hr, _, _ := syscall.SyscallN(cacheRequest.VTable().AddPattern, uintptr(unsafe.Pointer(cacheRequest)),
uintptr(patternId))
if hr != 0 {
err = ole.NewError(hr)
}
return
}
func addProperty(cacheRequet *IUIAutomationCacheRequest, propertyId PROPERTYID) (err error) {
hr, _, _ := syscall.SyscallN(cacheRequet.VTable().AddProperty, uintptr(unsafe.Pointer(cacheRequet)), uintptr(propertyId))
if hr != 0 {
err = ole.NewError(hr)
}
return
}