| 1 | //go:build windows |
| 2 | |
| 3 | package edge |
| 4 | |
| 5 | import ( |
| 6 | "unsafe" |
| 7 | |
| 8 | "golang.org/x/sys/windows" |
| 9 | ) |
| 10 | |
| 11 | type _ICoreWebView2ObjectCollectionViewVtbl struct { |
| 12 | _IUnknownVtbl |
| 13 | GetCount ComProc |
| 14 | GetValueAtIndex ComProc |
| 15 | } |
| 16 | |
| 17 | type ICoreWebView2ObjectCollectionView struct { |
| 18 | vtbl *_ICoreWebView2ObjectCollectionViewVtbl |
| 19 | } |
| 20 | |
| 21 | func (i *ICoreWebView2ObjectCollectionView) AddRef() error { |
| 22 | i.vtbl.AddRef.Call(uintptr(unsafe.Pointer(i))) |
| 23 | |
| 24 | return nil |
| 25 | } |
| 26 | |
| 27 | func (i *ICoreWebView2ObjectCollectionView) Release() error { |
| 28 | i.vtbl.Release.Call(uintptr(unsafe.Pointer(i))) |
| 29 | |
| 30 | return nil |
| 31 | } |
| 32 | |
| 33 | func (i *ICoreWebView2ObjectCollectionView) GetCount() (uint32, error) { |
| 34 | |
| 35 | var value uint32 |
| 36 | hr, _, _ := i.vtbl.GetCount.Call( |
| 37 | uintptr(unsafe.Pointer(i)), |
| 38 | uintptr(unsafe.Pointer(&value)), |
| 39 | ) |
| 40 | if windows.Handle(hr) != windows.S_OK { |
| 41 | return 0, windows.Errno(hr) |
| 42 | } |
| 43 | return value, nil |
| 44 | } |
| 45 | |
| 46 | func (i *ICoreWebView2ObjectCollectionView) GetValueAtIndex(index uint32) (*_IUnknownVtbl, error) { |
| 47 | |
| 48 | var value *_IUnknownVtbl |
| 49 | hr, _, _ := i.vtbl.GetValueAtIndex.Call( |
| 50 | uintptr(unsafe.Pointer(i)), |
| 51 | uintptr(index), |
| 52 | uintptr(unsafe.Pointer(&value)), |
| 53 | ) |
| 54 | if windows.Handle(hr) != windows.S_OK { |
| 55 | return nil, windows.Errno(hr) |
| 56 | } |
| 57 | return value, nil |
| 58 | } |
| 59 |