当前位置: 首页>>代码示例>>Python>>正文


Python automation.VARIANT类代码示例

本文整理汇总了Python中comtypes.automation.VARIANT的典型用法代码示例。如果您正苦于以下问题:Python VARIANT类的具体用法?Python VARIANT怎么用?Python VARIANT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VARIANT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_decimal

    def test_decimal(self):
        pi = Decimal("3.13")

        v = VARIANT()
        v.value = pi
        self.failUnlessEqual(v.vt, VT_CY)
        self.failUnlessEqual(v.value, pi)
开发者ID:Armaniac,项目名称:pyexternalboxespmw2,代码行数:7,代码来源:test_safearray.py

示例2: PutHardwareBreakPointer

 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,代码行数:28,代码来源:itpapi_i.py

示例3: test_datetime

    def test_datetime(self):
        now = datetime.datetime.now()

        v = VARIANT()
        v.value = now
        self.failUnlessEqual(v.value, now)
        self.failUnlessEqual(v.vt, VT_DATE)
开发者ID:Armaniac,项目名称:pyexternalboxespmw2,代码行数:7,代码来源:test_safearray.py

示例4: test_int

 def test_int(self):
     import array
     for typecode in "bhiBHIlL":
         a = array.array(typecode, (1, 1, 1, 1))
         v = VARIANT()
         v.value = a
         self.failUnlessEqual(v.value, (1, 1, 1, 1))
开发者ID:nikmolnar,项目名称:comtypes,代码行数:7,代码来源:test_variant.py

示例5: test_decimal_as_currency

    def test_decimal_as_currency(self):
        value = decimal.Decimal('3.14')

        v = VARIANT()
        v.value = value
        self.failUnlessEqual(v.vt, VT_CY)
        self.failUnlessEqual(v.value, value)
开发者ID:Python-Musings,项目名称:comtypes,代码行数:7,代码来源:test_variant.py

示例6: test_double

 def test_double(self):
     import array
     for typecode in "df":
         # because of FLOAT rounding errors, whi will only work for
         # certain values!
         a = array.array(typecode, (1.0, 2.0, 3.0, 4.5))
         v = VARIANT()
         v.value = a
         self.failUnlessEqual(v.value, (1.0, 2.0, 3.0, 4.5))
开发者ID:nikmolnar,项目名称:comtypes,代码行数:9,代码来源:test_variant.py

示例7: intToVariant

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,代码行数:9,代码来源:accessible_msaa.py

示例8: test_int

 def test_int(self):
     np = get_numpy()
     if np is None:
         return
     for dtype in ('int8', 'int16', 'int32', 'int64', 'uint8',
             'uint16', 'uint32', 'uint64'):
         a = np.array((1, 1, 1, 1), dtype=dtype)
         v = VARIANT()
         v.value = a
         self.failUnless((v.value == a).all())
开发者ID:Python-Musings,项目名称:comtypes,代码行数:10,代码来源:test_variant.py

示例9: test_mixed

    def test_mixed(self):
        np = get_numpy()
        if np is None:
            return

        now = datetime.datetime.now()
        a = np.array(
            [11, "22", None, True, now, decimal.Decimal("3.14")]).reshape(2,3)
        v = VARIANT()
        v.value = a
        self.failUnless((v.value == a).all())
开发者ID:Python-Musings,项目名称:comtypes,代码行数:11,代码来源:test_variant.py

示例10: test_double

 def test_double(self):
     np = get_numpy()
     if np is None:
         return
     for dtype in ('float32', 'float64'):
         # because of FLOAT rounding errors, whi will only work for
         # certain values!
         a = np.array([1.0, 2.0, 3.0, 4.5], dtype=dtype)
         v = VARIANT()
         v.value = a
         self.failUnless((v.value == a).all())
开发者ID:Python-Musings,项目名称:comtypes,代码行数:11,代码来源:test_variant.py

示例11: test_VARIANT_array

    def test_VARIANT_array(self):
        v = VARIANT()
        v.value = ((1, 2, 3), ("foo", "bar", None))
        self.failUnlessEqual(v.vt, VT_ARRAY | VT_VARIANT)
        self.failUnlessEqual(v.value, ((1, 2, 3), ("foo", "bar", None)))

        def func():
            v = VARIANT((1, 2, 3), ("foo", "bar", None))

        bytes = find_memleak(func)
        self.failIf(bytes, "Leaks %d bytes" % bytes)
开发者ID:Armaniac,项目名称:pyexternalboxespmw2,代码行数:11,代码来源:test_safearray.py

示例12: test_BSTR

    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,代码行数:12,代码来源:test_variant.py

示例13: test_ctypes_in_variant

 def test_ctypes_in_variant(self):
     v = VARIANT()
     objs = [(c_ubyte(3), VT_UI1),
             (c_char("x"), VT_UI1),
             (c_byte(3), VT_I1),
             (c_ushort(3), VT_UI2),
             (c_short(3), VT_I2),
             (c_uint(3), VT_UI4),
             (c_int(3), VT_I4),
             (c_double(3.14), VT_R8),
             (c_float(3.14), VT_R4),
             ]
     for value, vt in objs:
         v.value = value
         self.failUnlessEqual(v.vt, vt)
开发者ID:nikmolnar,项目名称:comtypes,代码行数:15,代码来源:test_variant.py

示例14: test_integers

    def test_integers(self):
        v = VARIANT()

        if (hasattr(sys, "maxint")):
            # this test doesn't work in Python 3000
            v.value = sys.maxint
            self.failUnlessEqual(v.value, sys.maxint)
            self.failUnlessEqual(type(v.value), int)

            v.value += 1
            self.failUnlessEqual(v.value, sys.maxint+1)
            self.failUnlessEqual(type(v.value), long)

        v.value = 1L
        self.failUnlessEqual(v.value, 1)
        self.failUnlessEqual(type(v.value), int)
开发者ID:nikmolnar,项目名称:comtypes,代码行数:16,代码来源:test_variant.py

示例15: test_com_pointers

    def test_com_pointers(self):
        # Storing a COM interface pointer in a VARIANT increments the refcount,
        # changing the variant to contain something else decrements it
        tlb = LoadRegTypeLib(GUID("{00020430-0000-0000-C000-000000000046}"), 2, 0, 0)
        rc = get_refcnt(tlb)

        v = VARIANT(tlb)
        self.failUnlessEqual(get_refcnt(tlb), rc+1)

        p = v.value
        self.failUnlessEqual(get_refcnt(tlb), rc+2)
        del p
        self.failUnlessEqual(get_refcnt(tlb), rc+1)

        v.value = None
        self.failUnlessEqual(get_refcnt(tlb), rc)
开发者ID:nikmolnar,项目名称:comtypes,代码行数:16,代码来源:test_variant.py


注:本文中的comtypes.automation.VARIANT类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。