> For posterity ...
>
> I posted a recepie a while ago on how to write a simple C++
> client for a Python com server.
>
> FYI to handle a COM method that has more than 1 argument, for some
> reason you
> have to reverse the order of arguments.
>
> For example, if the method is defined
>
> def my_method(self, a,b,c,d):
> ...
>
> Then your C++ client should look like :
>
> vargs[0]=arg4;
> vargs[1]=arg3;
> vargs[2]=arg2;
> vargs[3]=arg1;
>
> dp.rgvarg=vargs;
> dp.cArgs = 4; //how many args
>
> Where 'arg4' is the *last* argument ('d') (place it at array index 0
> rather
> than 3).
>
> Don't know why.
This is how IDispatch is documented to behave - eg, see
http://msdn2.microsoft.com/en-us/library/ms221653.aspx - "The arguments in
the array should be placed from last to first, so rgvarg[0] has the last
argument and rgvarg[cArgs -1] has the first argument." On a somewhat
related note, pywin32 recently had a bug where 'named params' would be
reversed when passed to python code, and while this fix will appear in build
211, it doesn't relate directly to your observation.
Cheers,
Mark
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32