[Tutor] win32com manual

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Mon Feb 9 12:41:46 EST 2004


You already have somewhat of a list at your disposal.  Alan mentioned
the Object Browser in PythonWin.  Once you have the display name (for
lack of a better/correct term) of the COM interface you want to use,
fire up "regedit" (at your own risk, of course ;-) and do a search for
that string.

For example, here is a COM interface I have never used and know nothing
about (except what can be gathered from the name) that shows up in the
PythonWin object browser:
COM MakeCab 1.0 Type Library

So how to access this via Python?  Well, I search the registry hive
HKEY_CLASSES_ROOT for values and data containing the term makecab.  In a
key named for the CLSID {8E17FFF3-...you get the picture} the ProgID key
contains a default value with the following data:
MakeCab.MakeCab.1
Two keys down there is a VersionIndependentProgID key with default value
data of MakeCab.MakeCab.  That's the one we want.

In PythonWin, I try:
>>> from win32com.client import Dispatch
>>> c = Dispatch('MakeCab.MakeCab')
>>>

Success!  But now, what do I do with it?

If I really wanted to use this interface, I would have ran makepy on the
MakeCab library so that I would get auto completion of
methods/attributes and then do a google search for the interface's
documentation.  For Microsoft COM interfaces, http://msdn.microsoft.com
is your friend.

I hope this helps out.

Christian
http://www.dowski.com

 -----Original Message-----
From: Shitiz Bansal [mailto:shitizb at yahoo.com] 
Sent: Sunday, February 08, 2004 6:25 AM
To: tutor at python.org
Subject: Re: [Tutor] win32com manual


Hi,
How about everyone mailing in the objects they are familiar with and
their methods( for the uninitiated we are talking about the objects
supported by Dispatch method in win32com).
Then perhaps we could compile them in a single place and post them at
python homepage, it could be a great tool for python programmers on
windows.
cyao
shitiz


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online



More information about the Tutor mailing list