[python-win32] Access COM object thru other than default interface
Jens B. Jorgensen
jens.jorgensen at tallan.com
Tue Aug 10 21:44:26 CEST 2004
It's been a while since I've done exactly this but I think what you want
to do is create an IBBBObject passing the object reference to it as a
parameter. I think you'll need to be using the makepy'd module for this
but I notice you are creating the object through Dispatch rather than
the module. Are you not including a makepy'd module?
paul at alanweberassociates.com wrote:
>I am working with a COM object that has the following custom COM class, with two coclass_interfaces (names have been changed to protect the proprietary):
>
>class MainObject(CoClassBaseClass): # A CoClass
> # Brand X MainObject Class
> CLSID = IID('{DEADBEEF-FFFF-1111-2222-000000000000}')
> coclass_sources = [
> ]
> coclass_interfaces = [
> IAAAObject,
> IBBBObject,
> ]
> default_interface = IAAAObject
>
>I am able to create a MainObject using
> myobj = win32com.client.Dispatch("BrandX.MainObject")
>and this gives me a myobj that repr's as:
><win32com.gen_py.BrandX Type Library.IMainObject instance at 0x23592352>
>
>and on myobj I can do invoke all of the IAAAObject methods.
>
>Now I need to do some IBBBObject-type work. How do I get to the IBBBObject methods? I've tried just invoking them, but I get the following error:
>
>Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 454, in __getattr__
> raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr)
>AttributeError: '<win32com.gen_py.BrandX Type Library.IMainObject instance at 0x23592352>' object has no attribute 'IBBBObjectMethod'
>
>(I've looked thru Python Programming on Win32, but I've not seen anything that looks relevant.)
>
>Thanks for the help, even if you can just RTFM me to an existing doc resource.
>
>-- Paul
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Python-win32 mailing list
>Python-win32 at python.org
>http://mail.python.org/mailman/listinfo/python-win32
>
>
--
Jens B. Jorgensen
jens.jorgensen at tallan.com
"With a focused commitment to our clients and our people, we deliver value through customized technology solutions"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2861 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.python.org/pipermail/python-win32/attachments/20040810/765c328a/smime.bin
More information about the Python-win32
mailing list