本文整理汇总了Python中comtypes.automation.VARIANT.vt方法的典型用法代码示例。如果您正苦于以下问题:Python VARIANT.vt方法的具体用法?Python VARIANT.vt怎么用?Python VARIANT.vt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comtypes.automation.VARIANT
的用法示例。
在下文中一共展示了VARIANT.vt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PutHardwareBreakPointer
# 需要导入模块: from comtypes.automation import VARIANT [as 别名]
# 或者: from comtypes.automation.VARIANT import vt [as 别名]
def PutHardwareBreakPointer(self, index, addr, active=1, c_uiDID=0, privmask=0, slot=0,
breaktype=u'Hardware', behavior=u'Execution', addrtype=u'IA32_PHY_PTR', dtsel=0, segsel=0, addrmask=0xffffffff):
if self._itpBreakPointObj == None:
return None
if not self.DoesSupportBreakPointType('Hardware execution breakpoint'):
return False
#arr = [[VARIANT(0), VARIANT(1), ConvertToByteArray(addr, 8), VARIANT(1)]]
arr = array.array('b')
arr.fromlist([0L])
bps = self._itpBreakPointObj.ReadBp(arr)
print bps
t = VARIANT()
t.vt = comtypes.automation.VT_EMPTY
t2 = VARIANT()
t2.vt = comtypes.automation.VT_INT
print self._itpBreakPointObj.QueryBpTypes(arr, 0x00000000L)
self._itpBreakPointObj.WriteBp(bps)
#arr = [0, 4, [segsel, ConvertToByteArray1(addr, 8), 0], 1]
#try:
# arr = [[0, [5, 0], [segsel, addr, 0], 1]]
# self._itpBreakPointObj.WriteBp(arr)
#except comtypes.COMError, hresult:
# print hresult
# return
"""
示例2: intToVariant
# 需要导入模块: from comtypes.automation import VARIANT [as 别名]
# 或者: from comtypes.automation.VARIANT import vt [as 别名]
def intToVariant(i):
'''
helper method, constructs Windows "VARIANT" object representing an integer
'''
v = VARIANT()
v.vt = VT_I4
v.value = i
assert( isinstance(i, int) )
return v
示例3: test_BSTR
# 需要导入模块: from comtypes.automation import VARIANT [as 别名]
# 或者: from comtypes.automation.VARIANT import vt [as 别名]
def test_BSTR(self):
v = VARIANT()
v.value = u"abc\x00123\x00"
self.failUnlessEqual(v.value, "abc\x00123\x00")
v.value = None
# manually clear the variant
v._.VT_I4 = 0
# NULL pointer BSTR should be handled as empty string
v.vt = VT_BSTR
self.failUnless(v.value in ("", None))
示例4: test_decimal_as_decimal
# 需要导入模块: from comtypes.automation import VARIANT [as 别名]
# 或者: from comtypes.automation.VARIANT import vt [as 别名]
def test_decimal_as_decimal(self):
v = VARIANT()
v.vt = VT_DECIMAL
v.decVal.Lo64 = 1234
v.decVal.scale = 3
self.failUnlessEqual(v.value, decimal.Decimal('1.234'))
v.decVal.sign = 0x80
self.failUnlessEqual(v.value, decimal.Decimal('-1.234'))
v.decVal.scale = 28
self.failUnlessEqual(v.value, decimal.Decimal('-1.234e-25'))
v.decVal.scale = 12
v.decVal.Hi32 = 100
self.failUnlessEqual(
v.value, decimal.Decimal('-1844674407.370955162834'))
示例5: set_variant_matrix
# 需要导入模块: from comtypes.automation import VARIANT [as 别名]
# 或者: from comtypes.automation.VARIANT import vt [as 别名]
def set_variant_matrix(self, value):
if not self.is_nested_iterable(value):
raise TypeError('Input data is not nested list/tuple.')
if self.is_ragged(value):
raise TypeError('Input data should not be a ragged array.')
num_row = len(value)
num_col = len(value[0])
variant = VARIANT()
_VariantClear(variant) # Clear the original data
rgsa = (_safearray.SAFEARRAYBOUND * 2)()
rgsa[0].cElements = num_row
rgsa[0].lBound = 0
rgsa[1].cElements = num_col
rgsa[1].lBound = 0
pa = _safearray.SafeArrayCreateEx(VT_VARIANT,
2,
rgsa, # rgsaBound
None) # pvExtra
if not pa:
raise MemoryError()
ptr = POINTER(VARIANT)() # container for the values
_safearray.SafeArrayAccessData(pa, byref(ptr))
try:
# I have no idea why 2D safearray is column-major.
index = 0
for n in range(num_col):
for m in range(num_row):
ptr[index] = value[m][n]
index += 1
finally:
_safearray.SafeArrayUnaccessData(pa)
memmove(byref(variant._), byref(pa), sizeof(pa))
variant.vt = VT_ARRAY | VT_VARIANT
return variant