win32com, handling byref

Clark C. Evans cce at clarkevans.com
Sun Mar 25 08:24:09 EST 2001


I am trying to call the following function from an ActiveX 
object.  It has a return value, plus three output parameters.
Unfortunately, the type library doesn't mark the last three
as "out", so I'm quite sure MakePy didn't generate a wrapper
which will help me.  

        long GetObjectAtXY(
                        [in] long x, 
                        [in] long y, 
                        [in] BSTR* pName,         /* output */
                        [in] BSTR* pLink,         /* output */
                        [in] long* plReserved);   /* output */

    def GetObjectAtXY(self, x=defaultNamedNotOptArg,
                            y=defaultNamedNotOptArg,
                        pName=defaultNamedNotOptArg,
                        pLink=defaultNamedNotOptArg,
                  plReserved=defaultNamedNotOptArg):
      """Get information about the object at a set of coordinates."""
      return self._oleobj_.InvokeTypes(0x5f, LCID, 1, (3, 0), 
             ((3, 1), (3,1), (16392, 1), (16392, 1), (16387, 1)), 
               x, y, pName, pLink, plReserved)

I was wondering if there is an incantation I can use which 
will allow me to do...

In Visual Basic, one would use:
   
    ret = GetObjectAtXY(x,y,name,link,res)

I'd like to do the following in Python...

    ret, name, link, res = GetObjectAtXY(x,y)

Is this even remotely possible?  If not, is there a description
of the low-level hoops that I could possibly jump through?

Thank you so much.

Clark





More information about the Python-list mailing list