當前位置: 首頁>>代碼示例>>Python>>正文


Python VARIANT.vt方法代碼示例

本文整理匯總了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
     """
開發者ID:bluewish,項目名稱:ProjectStudio,代碼行數:30,代碼來源:itpapi_i.py

示例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
開發者ID:askalski,項目名稱:mats,代碼行數:11,代碼來源:accessible_msaa.py

示例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))
開發者ID:nikmolnar,項目名稱:comtypes,代碼行數:14,代碼來源:test_variant.py

示例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'))
開發者ID:Python-Musings,項目名稱:comtypes,代碼行數:19,代碼來源:test_variant.py

示例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
開發者ID:xialulee,項目名稱:WaveSyn,代碼行數:44,代碼來源:modelnode.py


注:本文中的comtypes.automation.VARIANT.vt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。