idispatch.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2010-2012 The W32 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. // +build windows
  5. package w32
  6. import (
  7. "unsafe"
  8. )
  9. type pIDispatchVtbl struct {
  10. pQueryInterface uintptr
  11. pAddRef uintptr
  12. pRelease uintptr
  13. pGetTypeInfoCount uintptr
  14. pGetTypeInfo uintptr
  15. pGetIDsOfNames uintptr
  16. pInvoke uintptr
  17. }
  18. type IDispatch struct {
  19. lpVtbl *pIDispatchVtbl
  20. }
  21. func (this *IDispatch) QueryInterface(id *GUID) *IDispatch {
  22. return ComQueryInterface((*IUnknown)(unsafe.Pointer(this)), id)
  23. }
  24. func (this *IDispatch) AddRef() int32 {
  25. return ComAddRef((*IUnknown)(unsafe.Pointer(this)))
  26. }
  27. func (this *IDispatch) Release() int32 {
  28. return ComRelease((*IUnknown)(unsafe.Pointer(this)))
  29. }
  30. func (this *IDispatch) GetIDsOfName(names []string) []int32 {
  31. return ComGetIDsOfName(this, names)
  32. }
  33. func (this *IDispatch) Invoke(dispid int32, dispatch int16, params ...interface{}) *VARIANT {
  34. return ComInvoke(this, dispid, dispatch, params...)
  35. }