go-tg-screenshot-bot

Форк
0
420 строк · 16.0 Кб
1
// Copyright 2010 The win Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4

5
// +build windows
6

7
package win
8

9
import (
10
	"syscall"
11
	"unsafe"
12
)
13

14
type AnnoScope int
15

16
const (
17
	ANNO_THIS      = AnnoScope(0)
18
	ANNO_CONTAINER = AnnoScope(1)
19
)
20

21
type MSAAPROPID syscall.GUID
22

23
var (
24
	PROPID_ACC_NAME             = MSAAPROPID{0x608d3df8, 0x8128, 0x4aa7, [8]byte{0xa4, 0x28, 0xf5, 0x5e, 0x49, 0x26, 0x72, 0x91}}
25
	PROPID_ACC_VALUE            = MSAAPROPID{0x123fe443, 0x211a, 0x4615, [8]byte{0x95, 0x27, 0xc4, 0x5a, 0x7e, 0x93, 0x71, 0x7a}}
26
	PROPID_ACC_DESCRIPTION      = MSAAPROPID{0x4d48dfe4, 0xbd3f, 0x491f, [8]byte{0xa6, 0x48, 0x49, 0x2d, 0x6f, 0x20, 0xc5, 0x88}}
27
	PROPID_ACC_ROLE             = MSAAPROPID{0xcb905ff2, 0x7bd1, 0x4c05, [8]byte{0xb3, 0xc8, 0xe6, 0xc2, 0x41, 0x36, 0x4d, 0x70}}
28
	PROPID_ACC_STATE            = MSAAPROPID{0xa8d4d5b0, 0x0a21, 0x42d0, [8]byte{0xa5, 0xc0, 0x51, 0x4e, 0x98, 0x4f, 0x45, 0x7b}}
29
	PROPID_ACC_HELP             = MSAAPROPID{0xc831e11f, 0x44db, 0x4a99, [8]byte{0x97, 0x68, 0xcb, 0x8f, 0x97, 0x8b, 0x72, 0x31}}
30
	PROPID_ACC_KEYBOARDSHORTCUT = MSAAPROPID{0x7d9bceee, 0x7d1e, 0x4979, [8]byte{0x93, 0x82, 0x51, 0x80, 0xf4, 0x17, 0x2c, 0x34}}
31
	PROPID_ACC_DEFAULTACTION    = MSAAPROPID{0x180c072b, 0xc27f, 0x43c7, [8]byte{0x99, 0x22, 0xf6, 0x35, 0x62, 0xa4, 0x63, 0x2b}}
32
	PROPID_ACC_HELPTOPIC        = MSAAPROPID{0x787d1379, 0x8ede, 0x440b, [8]byte{0x8a, 0xec, 0x11, 0xf7, 0xbf, 0x90, 0x30, 0xb3}}
33
	PROPID_ACC_FOCUS            = MSAAPROPID{0x6eb335df, 0x1c29, 0x4127, [8]byte{0xb1, 0x2c, 0xde, 0xe9, 0xfd, 0x15, 0x7f, 0x2b}}
34
	PROPID_ACC_SELECTION        = MSAAPROPID{0xb99d073c, 0xd731, 0x405b, [8]byte{0x90, 0x61, 0xd9, 0x5e, 0x8f, 0x84, 0x29, 0x84}}
35
	PROPID_ACC_PARENT           = MSAAPROPID{0x474c22b6, 0xffc2, 0x467a, [8]byte{0xb1, 0xb5, 0xe9, 0x58, 0xb4, 0x65, 0x73, 0x30}}
36
	PROPID_ACC_NAV_UP           = MSAAPROPID{0x016e1a2b, 0x1a4e, 0x4767, [8]byte{0x86, 0x12, 0x33, 0x86, 0xf6, 0x69, 0x35, 0xec}}
37
	PROPID_ACC_NAV_DOWN         = MSAAPROPID{0x031670ed, 0x3cdf, 0x48d2, [8]byte{0x96, 0x13, 0x13, 0x8f, 0x2d, 0xd8, 0xa6, 0x68}}
38
	PROPID_ACC_NAV_LEFT         = MSAAPROPID{0x228086cb, 0x82f1, 0x4a39, [8]byte{0x87, 0x05, 0xdc, 0xdc, 0x0f, 0xff, 0x92, 0xf5}}
39
	PROPID_ACC_NAV_RIGHT        = MSAAPROPID{0xcd211d9f, 0xe1cb, 0x4fe5, [8]byte{0xa7, 0x7c, 0x92, 0x0b, 0x88, 0x4d, 0x09, 0x5b}}
40
	PROPID_ACC_NAV_PREV         = MSAAPROPID{0x776d3891, 0xc73b, 0x4480, [8]byte{0xb3, 0xf6, 0x07, 0x6a, 0x16, 0xa1, 0x5a, 0xf6}}
41
	PROPID_ACC_NAV_NEXT         = MSAAPROPID{0x1cdc5455, 0x8cd9, 0x4c92, [8]byte{0xa3, 0x71, 0x39, 0x39, 0xa2, 0xfe, 0x3e, 0xee}}
42
	PROPID_ACC_NAV_FIRSTCHILD   = MSAAPROPID{0xcfd02558, 0x557b, 0x4c67, [8]byte{0x84, 0xf9, 0x2a, 0x09, 0xfc, 0xe4, 0x07, 0x49}}
43
	PROPID_ACC_NAV_LASTCHILD    = MSAAPROPID{0x302ecaa5, 0x48d5, 0x4f8d, [8]byte{0xb6, 0x71, 0x1a, 0x8d, 0x20, 0xa7, 0x78, 0x32}}
44
	PROPID_ACC_ROLEMAP          = MSAAPROPID{0xf79acda2, 0x140d, 0x4fe6, [8]byte{0x89, 0x14, 0x20, 0x84, 0x76, 0x32, 0x82, 0x69}}
45
	PROPID_ACC_VALUEMAP         = MSAAPROPID{0xda1c3d79, 0xfc5c, 0x420e, [8]byte{0xb3, 0x99, 0x9d, 0x15, 0x33, 0x54, 0x9e, 0x75}}
46
	PROPID_ACC_STATEMAP         = MSAAPROPID{0x43946c5e, 0x0ac0, 0x4042, [8]byte{0xb5, 0x25, 0x07, 0xbb, 0xdb, 0xe1, 0x7f, 0xa7}}
47
	PROPID_ACC_DESCRIPTIONMAP   = MSAAPROPID{0x1ff1435f, 0x8a14, 0x477b, [8]byte{0xb2, 0x26, 0xa0, 0xab, 0xe2, 0x79, 0x97, 0x5d}}
48
	PROPID_ACC_DODEFAULTACTION  = MSAAPROPID{0x1ba09523, 0x2e3b, 0x49a6, [8]byte{0xa0, 0x59, 0x59, 0x68, 0x2a, 0x3c, 0x48, 0xfd}}
49
)
50

51
const (
52
	STATE_SYSTEM_NORMAL          = 0
53
	STATE_SYSTEM_UNAVAILABLE     = 0x1
54
	STATE_SYSTEM_SELECTED        = 0x2
55
	STATE_SYSTEM_FOCUSED         = 0x4
56
	STATE_SYSTEM_PRESSED         = 0x8
57
	STATE_SYSTEM_CHECKED         = 0x10
58
	STATE_SYSTEM_MIXED           = 0x20
59
	STATE_SYSTEM_INDETERMINATE   = STATE_SYSTEM_MIXED
60
	STATE_SYSTEM_READONLY        = 0x40
61
	STATE_SYSTEM_HOTTRACKED      = 0x80
62
	STATE_SYSTEM_DEFAULT         = 0x100
63
	STATE_SYSTEM_EXPANDED        = 0x200
64
	STATE_SYSTEM_COLLAPSED       = 0x400
65
	STATE_SYSTEM_BUSY            = 0x800
66
	STATE_SYSTEM_FLOATING        = 0x1000
67
	STATE_SYSTEM_MARQUEED        = 0x2000
68
	STATE_SYSTEM_ANIMATED        = 0x4000
69
	STATE_SYSTEM_INVISIBLE       = 0x8000
70
	STATE_SYSTEM_OFFSCREEN       = 0x10000
71
	STATE_SYSTEM_SIZEABLE        = 0x20000
72
	STATE_SYSTEM_MOVEABLE        = 0x40000
73
	STATE_SYSTEM_SELFVOICING     = 0x80000
74
	STATE_SYSTEM_FOCUSABLE       = 0x100000
75
	STATE_SYSTEM_SELECTABLE      = 0x200000
76
	STATE_SYSTEM_LINKED          = 0x400000
77
	STATE_SYSTEM_TRAVERSED       = 0x800000
78
	STATE_SYSTEM_MULTISELECTABLE = 0x1000000
79
	STATE_SYSTEM_EXTSELECTABLE   = 0x2000000
80
	STATE_SYSTEM_ALERT_LOW       = 0x4000000
81
	STATE_SYSTEM_ALERT_MEDIUM    = 0x8000000
82
	STATE_SYSTEM_ALERT_HIGH      = 0x10000000
83
	STATE_SYSTEM_PROTECTED       = 0x20000000
84
	STATE_SYSTEM_HASPOPUP        = 0x40000000
85
	STATE_SYSTEM_VALID           = 0x7fffffff
86
)
87

88
const (
89
	ROLE_SYSTEM_TITLEBAR           = 0x1
90
	ROLE_SYSTEM_MENUBAR            = 0x2
91
	ROLE_SYSTEM_SCROLLBAR          = 0x3
92
	ROLE_SYSTEM_GRIP               = 0x4
93
	ROLE_SYSTEM_SOUND              = 0x5
94
	ROLE_SYSTEM_CURSOR             = 0x6
95
	ROLE_SYSTEM_CARET              = 0x7
96
	ROLE_SYSTEM_ALERT              = 0x8
97
	ROLE_SYSTEM_WINDOW             = 0x9
98
	ROLE_SYSTEM_CLIENT             = 0xa
99
	ROLE_SYSTEM_MENUPOPUP          = 0xb
100
	ROLE_SYSTEM_MENUITEM           = 0xc
101
	ROLE_SYSTEM_TOOLTIP            = 0xd
102
	ROLE_SYSTEM_APPLICATION        = 0xe
103
	ROLE_SYSTEM_DOCUMENT           = 0xf
104
	ROLE_SYSTEM_PANE               = 0x10
105
	ROLE_SYSTEM_CHART              = 0x11
106
	ROLE_SYSTEM_DIALOG             = 0x12
107
	ROLE_SYSTEM_BORDER             = 0x13
108
	ROLE_SYSTEM_GROUPING           = 0x14
109
	ROLE_SYSTEM_SEPARATOR          = 0x15
110
	ROLE_SYSTEM_TOOLBAR            = 0x16
111
	ROLE_SYSTEM_STATUSBAR          = 0x17
112
	ROLE_SYSTEM_TABLE              = 0x18
113
	ROLE_SYSTEM_COLUMNHEADER       = 0x19
114
	ROLE_SYSTEM_ROWHEADER          = 0x1a
115
	ROLE_SYSTEM_COLUMN             = 0x1b
116
	ROLE_SYSTEM_ROW                = 0x1c
117
	ROLE_SYSTEM_CELL               = 0x1d
118
	ROLE_SYSTEM_LINK               = 0x1e
119
	ROLE_SYSTEM_HELPBALLOON        = 0x1f
120
	ROLE_SYSTEM_CHARACTER          = 0x20
121
	ROLE_SYSTEM_LIST               = 0x21
122
	ROLE_SYSTEM_LISTITEM           = 0x22
123
	ROLE_SYSTEM_OUTLINE            = 0x23
124
	ROLE_SYSTEM_OUTLINEITEM        = 0x24
125
	ROLE_SYSTEM_PAGETAB            = 0x25
126
	ROLE_SYSTEM_PROPERTYPAGE       = 0x26
127
	ROLE_SYSTEM_INDICATOR          = 0x27
128
	ROLE_SYSTEM_GRAPHIC            = 0x28
129
	ROLE_SYSTEM_STATICTEXT         = 0x29
130
	ROLE_SYSTEM_TEXT               = 0x2a
131
	ROLE_SYSTEM_PUSHBUTTON         = 0x2b
132
	ROLE_SYSTEM_CHECKBUTTON        = 0x2c
133
	ROLE_SYSTEM_RADIOBUTTON        = 0x2d
134
	ROLE_SYSTEM_COMBOBOX           = 0x2e
135
	ROLE_SYSTEM_DROPLIST           = 0x2f
136
	ROLE_SYSTEM_PROGRESSBAR        = 0x30
137
	ROLE_SYSTEM_DIAL               = 0x31
138
	ROLE_SYSTEM_HOTKEYFIELD        = 0x32
139
	ROLE_SYSTEM_SLIDER             = 0x33
140
	ROLE_SYSTEM_SPINBUTTON         = 0x34
141
	ROLE_SYSTEM_DIAGRAM            = 0x35
142
	ROLE_SYSTEM_ANIMATION          = 0x36
143
	ROLE_SYSTEM_EQUATION           = 0x37
144
	ROLE_SYSTEM_BUTTONDROPDOWN     = 0x38
145
	ROLE_SYSTEM_BUTTONMENU         = 0x39
146
	ROLE_SYSTEM_BUTTONDROPDOWNGRID = 0x3a
147
	ROLE_SYSTEM_WHITESPACE         = 0x3b
148
	ROLE_SYSTEM_PAGETABLIST        = 0x3c
149
	ROLE_SYSTEM_CLOCK              = 0x3d
150
	ROLE_SYSTEM_SPLITBUTTON        = 0x3e
151
	ROLE_SYSTEM_IPADDRESS          = 0x3f
152
	ROLE_SYSTEM_OUTLINEBUTTON      = 0x40
153
)
154

155
var (
156
	IID_IAccPropServer    = IID{0x76c0dbbb, 0x15e0, 0x4e7b, [8]byte{0xb6, 0x1b, 0x20, 0xee, 0xea, 0x20, 0x01, 0xe0}}
157
	IID_IAccPropServices  = IID{0x6e26e776, 0x04f0, 0x495d, [8]byte{0x80, 0xe4, 0x33, 0x30, 0x35, 0x2e, 0x31, 0x69}}
158
	CLSID_AccPropServices = CLSID{0xb5f8350b, 0x0548, 0x48b1, [8]byte{0xa6, 0xee, 0x88, 0xbd, 0x00, 0xb4, 0xa5, 0xe7}}
159
)
160

161
type IAccPropServerVtbl struct {
162
	QueryInterface uintptr
163
	AddRef         uintptr
164
	Release        uintptr
165
	GetPropValue   uintptr
166
}
167

168
type IAccPropServer struct {
169
	LpVtbl *IAccPropServerVtbl
170
}
171

172
type IAccPropServicesVtbl struct {
173
	QueryInterface               uintptr
174
	AddRef                       uintptr
175
	Release                      uintptr
176
	SetPropValue                 uintptr
177
	SetPropServer                uintptr
178
	ClearProps                   uintptr
179
	SetHwndProp                  uintptr
180
	SetHwndPropStr               uintptr
181
	SetHwndPropServer            uintptr
182
	ClearHwndProps               uintptr
183
	ComposeHwndIdentityString    uintptr
184
	DecomposeHwndIdentityString  uintptr
185
	SetHmenuProp                 uintptr
186
	SetHmenuPropStr              uintptr
187
	SetHmenuPropServer           uintptr
188
	ClearHmenuProps              uintptr
189
	ComposeHmenuIdentityString   uintptr
190
	DecomposeHmenuIdentityString uintptr
191
}
192

193
type IAccPropServices struct {
194
	LpVtbl *IAccPropServicesVtbl
195
}
196

197
func (obj *IAccPropServices) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
198
	ret, _, _ := syscall.Syscall(obj.LpVtbl.QueryInterface, 3,
199
		uintptr(unsafe.Pointer(obj)),
200
		uintptr(unsafe.Pointer(riid)),
201
		uintptr(unsafe.Pointer(ppvObject)))
202
	return HRESULT(ret)
203
}
204

205
func (obj *IAccPropServices) AddRef() uint32 {
206
	ret, _, _ := syscall.Syscall(obj.LpVtbl.AddRef, 1,
207
		uintptr(unsafe.Pointer(obj)),
208
		0,
209
		0)
210
	return uint32(ret)
211
}
212

213
func (obj *IAccPropServices) Release() uint32 {
214
	ret, _, _ := syscall.Syscall(obj.LpVtbl.Release, 1,
215
		uintptr(unsafe.Pointer(obj)),
216
		0,
217
		0)
218
	return uint32(ret)
219
}
220

221
// SetPropServer specifies a callback object to be used to annotate an array of properties for the accessible element. You can also specify whether the annotation is to be applied to this accessible element or to the element and its children. This method is used for server annotation.
222
// If server developers know the HWND of the accessible element they want to annotate, they can use SetHwndPropServer.
223
func (obj *IAccPropServices) SetPropServer(idString []byte, idProps []MSAAPROPID, server *IAccPropServer, annoScope AnnoScope) HRESULT {
224
	var idStringPtr unsafe.Pointer
225
	idStringLen := len(idString)
226
	if idStringLen != 0 {
227
		idStringPtr = unsafe.Pointer(&idString[0])
228
	}
229
	var idPropsPtr unsafe.Pointer
230
	idPropsLen := len(idProps)
231
	if idPropsLen != 0 {
232
		idPropsPtr = unsafe.Pointer(&idProps[0])
233
	}
234
	ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetPropServer, 7,
235
		uintptr(unsafe.Pointer(obj)),
236
		uintptr(idStringPtr),
237
		uintptr(idStringLen),
238
		uintptr(idPropsPtr),
239
		uintptr(idPropsLen),
240
		uintptr(unsafe.Pointer(server)),
241
		uintptr(annoScope),
242
		0,
243
		0)
244
	return HRESULT(ret)
245
}
246

247
// ClearProps restores default values to properties of accessible elements that they had previously annotated.
248
// If servers know the HWND of the object they want to clear, they can use ClearHwndProps.
249
func (obj *IAccPropServices) ClearProps(idString []byte, idProps []MSAAPROPID) HRESULT {
250
	var idStringPtr unsafe.Pointer
251
	idStringLen := len(idString)
252
	if idStringLen != 0 {
253
		idStringPtr = unsafe.Pointer(&idString[0])
254
	}
255
	var idPropsPtr unsafe.Pointer
256
	idPropsLen := len(idProps)
257
	if idPropsLen != 0 {
258
		idPropsPtr = unsafe.Pointer(&idProps[0])
259
	}
260
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.ClearProps, 5,
261
		uintptr(unsafe.Pointer(obj)),
262
		uintptr(idStringPtr),
263
		uintptr(idStringLen),
264
		uintptr(idPropsPtr),
265
		uintptr(idPropsLen),
266
		0)
267
	return HRESULT(ret)
268
}
269

270
// SetHwndPropServer wraps SetPropServer, providing a convenient entry point for callers who are annotating HWND-based accessible elements.
271
func (obj *IAccPropServices) SetHwndPropServer(hwnd HWND, idObject int32, idChild uint32, idProps []MSAAPROPID, server *IAccPropServer, annoScope AnnoScope) HRESULT {
272
	var idPropsPtr unsafe.Pointer
273
	idPropsLen := len(idProps)
274
	if idPropsLen != 0 {
275
		idPropsPtr = unsafe.Pointer(&idProps[0])
276
	}
277
	ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHwndPropServer, 8,
278
		uintptr(unsafe.Pointer(obj)),
279
		uintptr(hwnd),
280
		uintptr(idObject),
281
		uintptr(idChild),
282
		uintptr(idPropsPtr),
283
		uintptr(idPropsLen),
284
		uintptr(unsafe.Pointer(server)),
285
		uintptr(annoScope),
286
		0)
287
	return HRESULT(ret)
288
}
289

290
// ClearHwndProps wraps SetPropValue, SetPropServer, and ClearProps, and provides a convenient entry point for callers who are annotating HWND-based accessible elements.
291
func (obj *IAccPropServices) ClearHwndProps(hwnd HWND, idObject int32, idChild uint32, idProps []MSAAPROPID) HRESULT {
292
	var idPropsPtr unsafe.Pointer
293
	idPropsLen := len(idProps)
294
	if idPropsLen != 0 {
295
		idPropsPtr = unsafe.Pointer(&idProps[0])
296
	}
297
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.ClearHwndProps, 6,
298
		uintptr(unsafe.Pointer(obj)),
299
		uintptr(hwnd),
300
		uintptr(idObject),
301
		uintptr(idChild),
302
		uintptr(idPropsPtr),
303
		uintptr(idPropsLen))
304
	return HRESULT(ret)
305
}
306

307
// ComposeHwndIdentityString retrievs an identity string.
308
func (obj *IAccPropServices) ComposeHwndIdentityString(hwnd HWND, idObject int32, idChild uint32) (hr HRESULT, idString []byte) {
309
	var data *[1<<31 - 1]byte
310
	var len uint32
311
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.ComposeHwndIdentityString, 6,
312
		uintptr(unsafe.Pointer(obj)),
313
		uintptr(hwnd),
314
		uintptr(idObject),
315
		uintptr(idChild),
316
		uintptr(unsafe.Pointer(&data)),
317
		uintptr(unsafe.Pointer(&len)))
318
	hr = HRESULT(ret)
319
	if FAILED(hr) {
320
		return
321
	}
322
	defer CoTaskMemFree(uintptr(unsafe.Pointer(data)))
323
	idString = make([]byte, len)
324
	copy(idString, data[:len])
325
	return
326
}
327

328
// DecomposeHwndIdentityString determines the HWND, object ID, and child ID for the accessible element identified by the identity string.
329
func (obj *IAccPropServices) DecomposeHwndIdentityString(idString []byte) (hr HRESULT, hwnd HWND, idObject int32, idChild uint32) {
330
	var idStringPtr unsafe.Pointer
331
	idStringLen := len(idString)
332
	if idStringLen != 0 {
333
		idStringPtr = unsafe.Pointer(&idString[0])
334
	}
335
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.DecomposeHwndIdentityString, 6,
336
		uintptr(unsafe.Pointer(obj)),
337
		uintptr(idStringPtr),
338
		uintptr(idStringLen),
339
		uintptr(unsafe.Pointer(&hwnd)),
340
		uintptr(unsafe.Pointer(&idObject)),
341
		uintptr(unsafe.Pointer(&idChild)))
342
	hr = HRESULT(ret)
343
	return
344
}
345

346
// SetHmenuPropServer wraps SetPropServer, providing a convenient entry point for callers who are annotating HMENU-based accessible elements.
347
func (obj *IAccPropServices) SetHmenuPropServer(hmenu HMENU, idChild uint32, idProps []MSAAPROPID, server *IAccPropServer, annoScope AnnoScope) HRESULT {
348
	var idPropsPtr unsafe.Pointer
349
	idPropsLen := len(idProps)
350
	if idPropsLen != 0 {
351
		idPropsPtr = unsafe.Pointer(&idProps[0])
352
	}
353
	ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHmenuPropServer, 7,
354
		uintptr(unsafe.Pointer(obj)),
355
		uintptr(hmenu),
356
		uintptr(idChild),
357
		uintptr(idPropsPtr),
358
		uintptr(idPropsLen),
359
		uintptr(unsafe.Pointer(server)),
360
		uintptr(annoScope),
361
		0,
362
		0)
363
	return HRESULT(ret)
364
}
365

366
// ClearHmenuProps wraps ClearProps, and provides a convenient entry point for callers who are annotating HMENU-based accessible elements.
367
func (obj *IAccPropServices) ClearHmenuProps(hmenu HMENU, idChild uint32, idProps []MSAAPROPID) HRESULT {
368
	var idPropsPtr unsafe.Pointer
369
	idPropsLen := len(idProps)
370
	if idPropsLen != 0 {
371
		idPropsPtr = unsafe.Pointer(&idProps[0])
372
	}
373
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.ClearHmenuProps, 5,
374
		uintptr(unsafe.Pointer(obj)),
375
		uintptr(hmenu),
376
		uintptr(idChild),
377
		uintptr(idPropsPtr),
378
		uintptr(idPropsLen),
379
		0)
380
	return HRESULT(ret)
381
}
382

383
// ComposeHmenuIdentityString retrieves an identity string for an HMENU-based accessible element.
384
func (obj *IAccPropServices) ComposeHmenuIdentityString(hmenu HMENU, idChild uint32) (hr HRESULT, idString []byte) {
385
	var data *[1<<31 - 1]byte
386
	var len uint32
387
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.ComposeHmenuIdentityString, 5,
388
		uintptr(unsafe.Pointer(obj)),
389
		uintptr(hmenu),
390
		uintptr(idChild),
391
		uintptr(unsafe.Pointer(&data)),
392
		uintptr(unsafe.Pointer(&len)),
393
		0)
394
	hr = HRESULT(ret)
395
	if FAILED(hr) {
396
		return
397
	}
398
	defer CoTaskMemFree(uintptr(unsafe.Pointer(data)))
399
	idString = make([]byte, len)
400
	copy(idString, data[:len])
401
	return
402
}
403

404
// DecomposeHmenuIdentityString determines the HMENU, object ID, and child ID for the accessible element identified by the identity string.
405
func (obj *IAccPropServices) DecomposeHmenuIdentityString(idString []byte) (hr HRESULT, hmenu HMENU, idChild uint32) {
406
	var idStringPtr unsafe.Pointer
407
	idStringLen := len(idString)
408
	if idStringLen != 0 {
409
		idStringPtr = unsafe.Pointer(&idString[0])
410
	}
411
	ret, _, _ := syscall.Syscall6(obj.LpVtbl.DecomposeHmenuIdentityString, 5,
412
		uintptr(unsafe.Pointer(obj)),
413
		uintptr(idStringPtr),
414
		uintptr(idStringLen),
415
		uintptr(unsafe.Pointer(&hmenu)),
416
		uintptr(unsafe.Pointer(&idChild)),
417
		0)
418
	hr = HRESULT(ret)
419
	return
420
}
421

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.