Unable to create com object - need help

Roman Yakovenko roman.yakovenko at actimize.com
Wed Apr 14 08:34:22 EDT 2004


Thank you very much. I definitly will try your module.
Also I still have to questions:
1. How does VB success to work with this dll?
2. Why after using makepy utility I don't get interface registered in DiaSource class

I understand that the first question is generic one, and has nothing to do with python.
But any reference to this specifiec topic will be appreciated. Also I'd like to know the answer
to the second question. It will help me a lot in my future work

Roman.


> -----Original Message-----
> From: Thomas Heller [mailto:theller at python.net]
> Sent: Wednesday, April 14, 2004 2:57 PM
> To: python-list at python.org
> Subject: Re: Unable to create com object - need help
> 
> 
> "Roman Yakovenko" <roman.yakovenko at actimize.com> writes:
> 
> > 	Hi. I need some help. 
> > Here is my situation. It is a little bit difficult to 
> explain and/or understand.
> > I'd like to use msdia71.dll. This dll gives you access to 
> program database files
> > created during a build. I register this dll. This is pure com dll. 
> > This dll contains 3 top classes. I'd like to create one of 
> them - DiaSource. 
> > This class implements IDiaDataSource interface. This fact I 
> can see in dia2.idl. 
> >
> >  importlib("stdole2.tlb");
> >     [
> >         uuid(e60afbee-502d-46ae-858f-8272a09bd707),
> >         helpstring("DiaSource Class")
> >     ]
> >     coclass DiaSource
> >     {
> >         [default] interface IDiaDataSource;
> >     };
> >
> > after using makepy I get 
> >
> > class DiaSource(CoClassBaseClass): # A CoClass
> > 	# DiaSource Class
> > 	CLSID = IID('{E60AFBEE-502D-46AE-858F-8272A09BD707}')
> > 	coclass_sources = [
> > 	]
> > 	coclass_interfaces = [
> > 	]
> > If I understand right DiaSource doesn't implements 
> IDiaDataSource interface at all. 
> > May be this is a bug, may be I don't understand something. 
> Clarifying this point will be great.
> 
> I think this has to do with the fact that with pywin32 you 
> cannot access
> arbitrary com interfaces - only interfaces that either have 
> been wrapped
> in pythoncom.dll or that derive from IDispatch.  The DIA 
> interfaces all
> derive from IUnknown, so it seems you cannot call them.
> 
> There is ongoing work in pywin32 named 'universal' or something like
> that, but I don't know how far it is.
> 
> Another possibility is to use ctypes com layer, it has a tool somewhat
> similar to makepy - it's called readtlb.py, and creates 
> python wrappers
> for com interfaces.  ctypes.com has some samples 
> demonstrating all this.
> 
> HTH,
> 
> Thomas
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list