Пример #1
0
func GetIDsOfName(obj interface{}, method uintptr, names []string) (displayIDs []int32, err error) {
	wnames := make([]*uint16, len(names))
	for i := 0; i < len(names); i++ {
		ptr, err := syscall.UTF16PtrFromString(names[i])
		if err != nil {
			return
		}
		wnames[i] = ptr
	}

	displayIDs = make([]int32, len(names))
	dispIDs := make([]int32, len(names))
	namelen := uint32(len(names))

	err = com.HResultToError(syscall.Syscall6(
		method,
		uintptr(6),
		uintptr(unsafe.Pointer(obj)),
		uintptr(unsafe.Pointer(com.NullInterfaceID)),
		uintptr(unsafe.Pointer(&wnames[0])),
		uintptr(namelen),
		uintptr(com.GetDefaultUserLocaleID()),
		uintptr(unsafe.Pointer(&dispIDs[0]))))

	displayIDs = dispIDs[0:namelen]

	return
}
Пример #2
0
func GetTypeInfo(obj interface{}, method uintptr, num uint32) (tinfo *itypeinfo.TypeInfo, err error) {
	err = com.HResultToError(syscall.Syscall6(
		method,
		uintptr(4),
		uintptr(unsafe.Pointer(obj)),
		uintptr(num),
		uintptr(com.GetDefaultUserLocaleID()),
		uintptr(unsafe.Pointer(&tinfo)),
		uintptr(0),
		uintptr(0)))
	return
}