COM method with pointer args

Alex Martelli aleaxit at yahoo.com
Tue Jun 19 13:17:01 CEST 2001


"Levente Sandor" <sandorlevi at yahoo.com> wrote in message
news:8b5e42a6.0106181007.187e176d at posting.google.com...
> "Alex Martelli" <aleaxit at yahoo.com> wrote in message
news:<9gkek6024kl at enews2.newsguy.com>...
>
> > > Is there a possibility to use a COM method which requires pointer
> > > arguments?
> >
> > Sure, as long as you have a type library that is correct.  Make

This "as long as you" is a CRUCIAL prereq.  Clearly, from the
symptoms you indicate below, such as:

> "TypeError: This COM object can not automate the makepy process -

...there IS no correct type library connected to the "CorelDraw
Automation" objects you're trying to drive.  Without a typelib,
you're in trouble in several ways -- and [out] and [in,out]
arguments are the start of your problem ("requires POINTER
arguments" is most likely *NOT* the issue -- a pointer arg
can be declared [in], but then normal Automation dispatching
normally fixes things; the problem is, rather, with args that
are [out] or [in,out], which will always be pointer ones).

I have a hard time believing CorelDraw doesn't distribute a
correct typelibrary in SOME form or other -- a .TLB file, or
an .IDL one to be compiled, or (most usual) a resource in
some .DLL, .EXE or .OCX.  Apparently their objects' IDispatch
interfaces don't support GetTypeInfo, which is *VERY* bad
already, and an almost-unbelievable degree of misbehavior
when coupled with rarely-used idioms such as [out] or [in,out]
arguments in Automation objects.

Hmmm, let's see, in what form do they document their Automation
facility?  If they give you instructions for using it from
Visual Basic, there is likely to be some information about
what you're supposed to hook from Project/References... --
that information is likely to be the typelibrary so-called
"friendly name", and you can use that with makepy.  Or if
they give you instructions for using it from Visual C++,
it's probably couched in terms of #import -- the file that
you're supposed to use with #import is or contains the tlib,
so you could use *THAT* with makepy...


Remember to start afresh by deleting the gen_py directory
every time you want to rebuild the Python wrappers for a
type library or part thereof, or halfway-succeded previous
attempts may play havoc with the current ones...


Alex






More information about the Python-list mailing list