[python-win32] Python COM Server, C++ Client - How ??? (multiple arguments)

Aviel, Gal gal.aviel at intel.com
Tue Oct 23 09:49:08 CEST 2007


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.

Hope this helps future googlers..
thanks - Gal. 



More information about the python-win32 mailing list