On Monday, December 10, 2012 8:16:43 PM UTC-5, Mark Hammond wrote: > "out" params are best supported if the object supplied a typelib - then > Python knows the params are out and does the right thing automagically. > If out params are detected, the result of the function will be a tuple > of (real_result, out_param1, ...) > > Even if no typelib is supported, you can access them with a little pain > via the win32com.client.Dispatch() object. You might like to follow up > to the python-wi...@python.org mailing list where many people will be > able to help. > > HTH, > > Mark
Mark, thanks for the reply. In this case, I have a type library and attempted to use MakePy but it doesn't seem to be working as expected. I was reading through CH12 of your Python Programming on Win32 book (http://oreilly.com/catalog/pythonwin32/chapter/ch12.html). I was hopeful given your description of MakePy that I could get this to work. It appears that you're saying MakePy will convert "byref" args in a function over to return values. For example, the IDL in the server includes the following 3 functions. [id(1)] void ShowMessage(BSTR msg); [id(2)] void GetSettingValue(BSTR settingName, BSTR* settingValue); [id(3)] void SetSettingValue(BSTR settingName, BSTR settingValue); The thorny one is the GetSettingValue since it takes the out param. When I run MakePy, it generates the below. def ShowMessage(self, msg=defaultNamedNotOptArg): return self._oleobj_.InvokeTypes(1, LCID, 1, (24, 0), ((8, 0),),msg ) def GetSettingValue(self, settingName=defaultNamedNotOptArg, settingValue=defaultNamedNotOptArg): return self._oleobj_.InvokeTypes(2, LCID, 1, (24, 0), ((8, 0), (16392, 0)),settingName , settingValue) def SetSettingValue(self, settingName=defaultNamedNotOptArg, settingValue=defaultNamedNotOptArg): return self._oleobj_.InvokeTypes(3, LCID, 1, (24, 0), ((8, 0), (8, 0)),settingName , settingValue) I noticed that the argument type is different for the out param (16392 instead of 8). However, it doesn't appear to me that its generating return values instead of args (though I'm not very experienced in python). I tried invoking these in python. The ShowMessage and SetSettingValue work great. I can't get the GetSettingValue to work though. Perhaps there's a different syntax I need when using the MakePy generated code? -- http://mail.python.org/mailman/listinfo/python-list