Documentation ¶
Overview ¶
Helpers for COM
Package is meant to retrieve and process safe array data returned from COM.
Helper for converting SafeArray to array of objects.
Index ¶
- Constants
- Variables
- func BytePtrToString(p *byte) string
- func CoInitialize(p uintptr) (err error)
- func CoInitializeEx(p uintptr, coinit uint32) (err error)
- func CoUninitialize()
- func DispatchMessage(msg *Msg) (ret int32)
- func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error)
- func GetUserDefaultLCID() (lcid uint32)
- func IsEqualGUID(guid1 *GUID, guid2 *GUID) bool
- func StringFromCLSID(clsid *GUID) (str string, err error)
- func StringFromIID(iid *GUID) (str string, err error)
- func SysAllocString(v string) (ss *int16)
- func SysFreeString(v *int16) (err error)
- func SysStringLen(v *int16) uint32
- func UTF16PtrToString(p *uint16) string
- func VariantClear(v *VARIANT) (err error)
- func VariantInit(v *VARIANT) (err error)
- type Connection
- type DISPPARAMS
- type Dispatch
- func (d *Dispatch) Call(method string, params ...interface{}) (result *VARIANT, err error)
- func (d *Dispatch) Get(name string, params ...interface{}) (result *VARIANT, err error)
- func (d *Dispatch) GetId(name string) (id int32, err error)
- func (d *Dispatch) GetIds(names ...string) (dispid []int32, err error)
- func (d *Dispatch) Invoke(id int32, dispatch int16, params []interface{}) (result *VARIANT, err error)
- func (d *Dispatch) MustCall(method string, params ...interface{}) (result *VARIANT)
- func (d *Dispatch) MustGet(name string, params ...interface{}) (result *VARIANT)
- func (d *Dispatch) MustSet(name string, params ...interface{}) (result *VARIANT)
- func (d *Dispatch) Release()
- func (d *Dispatch) Set(name string, params ...interface{}) (result *VARIANT, err error)
- type EXCEPINFO
- type GUID
- type IConnectionPoint
- func (v *IConnectionPoint) AddRef() int32
- func (v *IConnectionPoint) Advise(unknown *IUnknown) (cookie uint32, err error)
- func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) (err error)
- func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32
- func (v *IConnectionPoint) QueryInterface(iid *GUID) (disp *IDispatch, err error)
- func (v *IConnectionPoint) Release() int32
- func (v *IConnectionPoint) Unadvise(cookie uint32) (err error)
- type IConnectionPointContainer
- func (v *IConnectionPointContainer) AddRef() int32
- func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) (err error)
- func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) (err error)
- func (v *IConnectionPointContainer) QueryInterface(iid *GUID) (disp *IDispatch, err error)
- func (v *IConnectionPointContainer) Release() int32
- type IDLDESC
- type IDispatch
- func (v *IDispatch) AddRef() int32
- func (v *IDispatch) GetIDsOfName(names []string) (dispid []int32, err error)
- func (v *IDispatch) GetTypeInfo() (tinfo *ITypeInfo, err error)
- func (v *IDispatch) GetTypeInfoCount() (c uint32, err error)
- func (v *IDispatch) Invoke(dispid int32, dispatch int16, params ...interface{}) (result *VARIANT, err error)
- func (v *IDispatch) MustQueryInterface(iid *GUID) (disp *IDispatch)
- func (v *IDispatch) QueryInterface(iid *GUID) (disp *IDispatch, err error)
- func (v *IDispatch) Release() int32
- type INTERFACEDATA
- type IProvideClassInfo
- type ITypeInfo
- type IUnknown
- type METHODDATA
- type Msg
- type OleError
- type PARAMDATA
- type Point
- type SAFEARRAY
- type SAFEARRAYBOUND
- type SafeArray
- type SafeArrayBound
- type SafeArrayConversion
- func (sac *SafeArrayConversion) GetDimensions() (dimensions *uint32, err error)
- func (sac *SafeArrayConversion) GetSize() (length *uint32, err error)
- func (sac *SafeArrayConversion) GetType() (varType uint16, err error)
- func (sac *SafeArrayConversion) Release()
- func (sac *SafeArrayConversion) ToStringArray() (strings []string)
- func (sac *SafeArrayConversion) TotalElements(index uint32) (totalElements int64, err error)
- type TYPEATTR
- type TYPEDESC
- type UnknownLike
- type VARIANT
Constants ¶
View Source
const ( CLSCTX_INPROC_SERVER = 1 CLSCTX_INPROC_HANDLER = 2 CLSCTX_LOCAL_SERVER = 4 CLSCTX_INPROC_SERVER16 = 8 CLSCTX_REMOTE_SERVER = 16 CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER )
View Source
const ( COINIT_APARTMENTTHREADED = 0x2 COINIT_MULTITHREADED = 0x0 COINIT_DISABLE_OLE1DDE = 0x4 COINIT_SPEED_OVER_MEMORY = 0x8 )
View Source
const ( DISPATCH_METHOD = 1 DISPATCH_PROPERTYGET = 2 DISPATCH_PROPERTYPUT = 4 DISPATCH_PROPERTYPUTREF = 8 )
View Source
const ( S_OK = 0x00000000 E_UNEXPECTED = 0x8000FFFF E_NOTIMPL = 0x80004001 E_OUTOFMEMORY = 0x8007000E E_INVALIDARG = 0x80070057 E_NOINTERFACE = 0x80004002 E_POINTER = 0x80004003 E_HANDLE = 0x80070006 E_ABORT = 0x80004004 E_FAIL = 0x80004005 E_ACCESSDENIED = 0x80070005 E_PENDING = 0x8000000A CO_E_CLASSSTRING = 0x800401F3 )
View Source
const ( CC_FASTCALL = iota CC_CDECL CC_MSCPASCAL CC_PASCAL = CC_MSCPASCAL CC_MACPASCAL CC_STDCALL CC_FPFASTCALL CC_SYSCALL CC_MPWCDECL CC_MPWPASCAL CC_MAX = CC_MPWPASCAL )
View Source
const ( VT_EMPTY = 0x0 VT_NULL = 0x1 VT_I2 = 0x2 VT_I4 = 0x3 VT_R4 = 0x4 VT_R8 = 0x5 VT_CY = 0x6 VT_DATE = 0x7 VT_BSTR = 0x8 VT_DISPATCH = 0x9 VT_ERROR = 0xa VT_BOOL = 0xb VT_VARIANT = 0xc VT_UNKNOWN = 0xd VT_DECIMAL = 0xe VT_I1 = 0x10 VT_UI1 = 0x11 VT_UI2 = 0x12 VT_UI4 = 0x13 VT_I8 = 0x14 VT_UI8 = 0x15 VT_INT = 0x16 VT_UINT = 0x17 VT_VOID = 0x18 VT_HRESULT = 0x19 VT_PTR = 0x1a VT_SAFEARRAY = 0x1b VT_CARRAY = 0x1c VT_USERDEFINED = 0x1d VT_LPSTR = 0x1e VT_LPWSTR = 0x1f VT_RECORD = 0x24 VT_INT_PTR = 0x25 VT_UINT_PTR = 0x26 VT_FILETIME = 0x40 VT_BLOB = 0x41 VT_STREAM = 0x42 VT_STORAGE = 0x43 VT_STREAMED_OBJECT = 0x44 VT_STORED_OBJECT = 0x45 VT_BLOB_OBJECT = 0x46 VT_CF = 0x47 VT_CLSID = 0x48 VT_BSTR_BLOB = 0xfff VT_VECTOR = 0x1000 VT_ARRAY = 0x2000 VT_BYREF = 0x4000 VT_RESERVED = 0x8000 VT_ILLEGAL = 0xffff VT_ILLEGALMASKED = 0xfff VT_TYPEMASK = 0xfff )
View Source
const ( DISPID_UNKNOWN = -1 DISPID_VALUE = 0 DISPID_PROPERTYPUT = -3 DISPID_NEWENUM = -4 DISPID_EVALUATE = -5 DISPID_CONSTRUCTOR = -6 DISPID_DESTRUCTOR = -7 DISPID_COLLECT = -8 )
View Source
const ( TKIND_ENUM = 1 TKIND_RECORD = 2 TKIND_MODULE = 3 TKIND_INTERFACE = 4 TKIND_DISPATCH = 5 TKIND_COCLASS = 6 TKIND_ALIAS = 7 TKIND_UNION = 8 TKIND_MAX = 9 )
View Source
const ( FADF_AUTO = 0x0001 FADF_STATIC = 0x0002 FADF_EMBEDDED = 0x0004 FADF_FIXEDSIZE = 0x0010 FADF_RECORD = 0x0020 FADF_HAVEIID = 0x0040 FADF_HAVEVARTYPE = 0x0080 FADF_BSTR = 0x0100 FADF_UNKNOWN = 0x0200 FADF_DISPATCH = 0x0400 FADF_VARIANT = 0x0800 FADF_RESERVED = 0xF008 )
Variables ¶
View Source
var ( IID_NULL = &GUID{0x00000000, 0x0000, 0x0000, [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}} IID_IUnknown = &GUID{0x00000000, 0x0000, 0x0000, [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}} IID_IDispatch = &GUID{0x00020400, 0x0000, 0x0000, [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}} IID_IConnectionPointContainer = &GUID{0xB196B284, 0xBAB4, 0x101A, [8]byte{0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07}} IID_IConnectionPoint = &GUID{0xB196B286, 0xBAB4, 0x101A, [8]byte{0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07}} IID_IProvideClassInfo = &GUID{0xb196b283, 0xbab4, 0x101a, [8]byte{0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07}} )
Functions ¶
func BytePtrToString ¶
func CoInitialize ¶
func CoInitializeEx ¶
func CoUninitialize ¶
func CoUninitialize()
func DispatchMessage ¶
func GetMessage ¶
func GetUserDefaultLCID ¶
func GetUserDefaultLCID() (lcid uint32)
func IsEqualGUID ¶
func StringFromCLSID ¶
func StringFromIID ¶
func SysAllocString ¶
func SysFreeString ¶
func SysStringLen ¶
func UTF16PtrToString ¶
func VariantClear ¶
func VariantInit ¶
Types ¶
type Connection ¶
type Connection struct {
Object *IUnknown // Access COM
}
func Connect ¶
func Connect(names ...string) (connection *Connection)
func (*Connection) Create ¶
func (c *Connection) Create(progId string) (err error)
Creates Unknown object based first on ProgId and then from String.
func (*Connection) Dispatch ¶
func (c *Connection) Dispatch() (object *Dispatch, err error)
func (*Connection) Initialize ¶
func (*Connection) Initialize() (err error)
func (*Connection) Load ¶
func (c *Connection) Load(names ...string) (errors []error)
Loads COM object if in list
func (*Connection) Release ¶
func (c *Connection) Release()
func (*Connection) Uninitialize ¶
func (*Connection) Uninitialize()
type DISPPARAMS ¶
type DISPPARAMS struct {
// contains filtered or unexported fields
}
type Dispatch ¶
type Dispatch struct {
Object *IDispatch // Dispatch object.
}
func (*Dispatch) Invoke ¶
func (d *Dispatch) Invoke(id int32, dispatch int16, params []interface{}) (result *VARIANT, err error)
There have been problems where if send cascading params..., it would error out because the parameters would be empty.
type IConnectionPoint ¶
type IConnectionPoint struct {
// contains filtered or unexported fields
}
func (*IConnectionPoint) AddRef ¶
func (v *IConnectionPoint) AddRef() int32
func (*IConnectionPoint) Advise ¶
func (v *IConnectionPoint) Advise(unknown *IUnknown) (cookie uint32, err error)
func (*IConnectionPoint) EnumConnections ¶
func (v *IConnectionPoint) EnumConnections(p *unsafe.Pointer) (err error)
func (*IConnectionPoint) GetConnectionInterface ¶
func (v *IConnectionPoint) GetConnectionInterface(piid **GUID) int32
func (*IConnectionPoint) QueryInterface ¶
func (v *IConnectionPoint) QueryInterface(iid *GUID) (disp *IDispatch, err error)
func (*IConnectionPoint) Release ¶
func (v *IConnectionPoint) Release() int32
func (*IConnectionPoint) Unadvise ¶
func (v *IConnectionPoint) Unadvise(cookie uint32) (err error)
type IConnectionPointContainer ¶
type IConnectionPointContainer struct {
// contains filtered or unexported fields
}
func (*IConnectionPointContainer) AddRef ¶
func (v *IConnectionPointContainer) AddRef() int32
func (*IConnectionPointContainer) EnumConnectionPoints ¶
func (v *IConnectionPointContainer) EnumConnectionPoints(points interface{}) (err error)
func (*IConnectionPointContainer) FindConnectionPoint ¶
func (v *IConnectionPointContainer) FindConnectionPoint(iid *GUID, point **IConnectionPoint) (err error)
func (*IConnectionPointContainer) QueryInterface ¶
func (v *IConnectionPointContainer) QueryInterface(iid *GUID) (disp *IDispatch, err error)
func (*IConnectionPointContainer) Release ¶
func (v *IConnectionPointContainer) Release() int32
type IDispatch ¶
type IDispatch struct {
// contains filtered or unexported fields
}
func CreateStdDispatch ¶
func (*IDispatch) GetIDsOfName ¶
func (*IDispatch) GetTypeInfo ¶
func (*IDispatch) GetTypeInfoCount ¶
func (*IDispatch) MustQueryInterface ¶
func (*IDispatch) QueryInterface ¶
type INTERFACEDATA ¶
type INTERFACEDATA struct { MethodData *METHODDATA CMembers uint32 }
type IProvideClassInfo ¶
type IProvideClassInfo struct {
// contains filtered or unexported fields
}
func (*IProvideClassInfo) AddRef ¶
func (v *IProvideClassInfo) AddRef() int32
func (*IProvideClassInfo) GetClassInfo ¶
func (v *IProvideClassInfo) GetClassInfo() (cinfo *ITypeInfo, err error)
func (*IProvideClassInfo) QueryInterface ¶
func (v *IProvideClassInfo) QueryInterface(iid *GUID) (disp *IDispatch, err error)
func (*IProvideClassInfo) Release ¶
func (v *IProvideClassInfo) Release() int32
type ITypeInfo ¶
type ITypeInfo struct {
// contains filtered or unexported fields
}
func (*ITypeInfo) GetTypeAttr ¶
func (*ITypeInfo) QueryInterface ¶
type IUnknown ¶
type IUnknown struct {
// contains filtered or unexported fields
}
func CreateDispTypeInfo ¶
func CreateDispTypeInfo(idata *INTERFACEDATA) (pptinfo *IUnknown, err error)
func (*IUnknown) MustQueryInterface ¶
func (*IUnknown) QueryInterface ¶
type METHODDATA ¶
type OleError ¶
type OleError struct {
// contains filtered or unexported fields
}
func NewErrorWithDescription ¶
func (*OleError) Description ¶
type SAFEARRAY ¶
type SAFEARRAY SafeArray
Obsolete, exists for backwards compatibility. Use SafeArray
type SAFEARRAYBOUND ¶
type SAFEARRAYBOUND SafeArrayBound
Obsolete, exists for backwards compatibility. Use SafeArrayBound
type SafeArrayBound ¶
type SafeArrayConversion ¶
type SafeArrayConversion struct {
Array *SafeArray
}
func (*SafeArrayConversion) GetDimensions ¶
func (sac *SafeArrayConversion) GetDimensions() (dimensions *uint32, err error)
func (*SafeArrayConversion) GetSize ¶
func (sac *SafeArrayConversion) GetSize() (length *uint32, err error)
func (*SafeArrayConversion) GetType ¶
func (sac *SafeArrayConversion) GetType() (varType uint16, err error)
func (*SafeArrayConversion) Release ¶
func (sac *SafeArrayConversion) Release()
Release Safe Array memory
func (*SafeArrayConversion) ToStringArray ¶
func (sac *SafeArrayConversion) ToStringArray() (strings []string)
func (*SafeArrayConversion) TotalElements ¶
func (sac *SafeArrayConversion) TotalElements(index uint32) (totalElements int64, err error)
type TYPEATTR ¶
type TYPEATTR struct { Guid GUID Lcid uint32 MemidConstructor int32 MemidDestructor int32 LpstrSchema *uint16 CbSizeInstance uint32 Typekind int32 CFuncs uint16 CVars uint16 CImplTypes uint16 CbSizeVft uint16 CbAlignment uint16 WTypeFlags uint16 WMajorVerNum uint16 WMinorVerNum uint16 TdescAlias TYPEDESC IdldescType IDLDESC // contains filtered or unexported fields }
type UnknownLike ¶
type VARIANT ¶
type VARIANT struct { VT uint16 // 2 // On 32-bit windows, sizeof(VARIANT) is 16. 64-bit is 24. Although an int would // be that size, stick with int64 due to conversions in invoke. 32-bit machines // will thus have 8-bytes of unused space. Val int64 Val2 int64 // contains filtered or unexported fields }
func (*VARIANT) ToArray ¶
func (v *VARIANT) ToArray() *SafeArrayConversion
func (*VARIANT) ToIDispatch ¶
func (*VARIANT) ToIUnknown ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.