Unable to create com object - need help

Roman Yakovenko roman.yakovenko at actimize.com
Wed Apr 14 09:21:01 EDT 2004


Sorry, wrong alarm. The only thing that is wrong is an order of class
defined in generated module. IEnumUnknown defined after first use.

Roman

> -----Original Message-----
> From: Roman Yakovenko 
> Sent: Wednesday, April 14, 2004 4:06 PM
> To: python-list at python.org
> Subject: RE: Unable to create com object - need help
> 
> 
> I tried your module. It seems that you generate code right :-)
> but IEnumUnknown doesn't defined in any file. 
> I can try to edit ctypes.com.__init__.py to get the desired result.
> But before I do this I'd like to ask you do you have more 
> recent version that fix it.
> If so I'll be glad. If not I will try to write a patch.
> 
> Roman
> 
> > -----Original Message-----
> > From: Roman Yakovenko 
> > Sent: Wednesday, April 14, 2004 3:34 PM
> > To: python-list at python.org
> > Subject: RE: Unable to create com object - need help
> > 
> > 
> > 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
> > > 
> > 
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list
> > 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list