Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73480

Re: comtypes

Path csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Thomas Heller <theller@ctypes.org>
Newsgroups comp.lang.python
Subject Re: comtypes
Date Sat, 21 Jun 2014 20:17:23 +0200
Lines 22
Message-ID <c0m0cuFku88U1@mid.individual.net> (permalink)
References <7b0712bf-68b0-4183-860d-2a39d22b62f4@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net SA0J0LijWYc9837I13wNHwIJY4S/UGW98987sxAUWrueDaqYs=
Cancel-Lock sha1:2ETotmpc6/h7qyswhofGMBfhShI=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <7b0712bf-68b0-4183-860d-2a39d22b62f4@googlegroups.com>
Xref csiph.com comp.lang.python:73480

Show key headers only | View raw


Am 21.06.2014 09:08, schrieb peter.balazovic@emspin.com:
> Dears,
>
> I am not sure I am at right place here. Now I've started working with comtypes 1.1.0 package within python 2.7.6.1. I have ActiveX COM object I want access and work with it.
>
> I do following
>>> from comtypes.client import CreateObject
>>> fm = CreateObject("MCB.PCM")
>>> dwt = fm.ReadVariable("dwt")
>>> print dwt
> (<comtypes.automation.LP_tagVARIANT object at 0x05A8E1C0>, <comtypes.automation.LP_tagVARIANT object at 0x05A8E210>, <comtypes.automation.LP_tagVARIANT object at 0x05A8E260>, True)
>
> by using print gives me return values. I want to access return data (array)and  variable. How can I correctly handle it?

dwt apparently is an array containing pointers to VARIANTs.  In
comtypes (or ctypes) you dereference pointer by indexing them with zero.
So something like this could work:

for item in dwt:
     print item[0]

Thomas

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

comtypes peter.balazovic@emspin.com - 2014-06-21 00:08 -0700
  Re: comtypes John Gordon <gordon@panix.com> - 2014-06-21 16:34 +0000
    Re: comtypes peter.balazovic@emspin.com - 2014-06-21 10:09 -0700
  Re: comtypes Thomas Heller <theller@ctypes.org> - 2014-06-21 20:17 +0200
    Re: comtypes peter.balazovic@emspin.com - 2014-06-21 12:08 -0700

csiph-web