[BangPypers] win32com.client.Dispatch

Vishal vsapre80 at gmail.com
Wed Dec 28 11:32:28 CET 2011

On Tue, Dec 27, 2011 at 5:34 PM, Nitin Kumar <nitin.nitp at gmail.com> wrote:

> Hi All,
> Say I did
> x=win32com.client.Dispatch("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")
> where the clsid used is for window media palyer.
> Now if i do:
> >>> dir(x)
> ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_',
> '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__',
> '__getattr__', '__getitem__', '__init__', '__int__', '__len__',
> '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__',
> '__setitem__', '__str__', '_builtMethods_', '_enum_',
> '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_',
> '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_',
> '_print_details_', '_proc_', '_unicode_to_string_', '_username_',
> '_wrap_dispatch_']
> It won't show any function related to this specific dll. This happens with
> any COMObject.
> So, is there any way to find out what all functions can be used with this
> object. (or any doc to give more depth)
> --
> Nitin K
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers


>From what I remember having worked on COM/DCOM a few years back, the DLL
needs to have functions defined using a certain return type for all the
functions that are exposed. Then the win32com module can query the DLL to
see what functions are present. Please note that even if they cannot be
queried, they can certainly be used, if you know their signature.

Also look at how to launch an Automation Application from OLE Automation
from Python examples on the web. There are slight differences in how you
launch, and that may be the reason.

PythonWin IDE that comes with the PyWin32 libraries has a OLE/COM Object
viewer that should be able to show you all the functions that are exposed
by a registered DLL.

Thanks and best regards,
Vishal Sapre

More information about the BangPypers mailing list