I'm trying to drive an application via it's COM interface but I am having trouble with ByRef parameters.<br><br>The method I'm having trouble with, in VB, is:<br>Public Function GetVuserTypeLicenseLimit( ByVal strVuserType As String, ByRef pRetLimit As Long ) As Long<br>
<br>translating this into python as:<br>a = o.GetVuserTypeLicenseLimit("userType")<br><br>gives me:<br><br>com_error: (-2147352561, 'Parameter not optional.', None, None)<br><br>Now, I played about with the .py file generated by makepy to see if I could persuade it to play nicely but nothing affected the result. Eventually I changed the .py file so that the interface was:<br>
<br> def xxGetVuserTypeLicenseLimit(self, strVuserType=defaultNamedNotOptArg, pRetLimit=defaultNamedNotOptArg):<br> """Get the License limit for the Vuser Type """<br> return self._oleobj_.InvokeTypes(8, LCID, 1, (3, 0), ((8, 1), (16387, 0)),strVuserType<br>
, pRetLimit)<br><br>and it still didn't change anything! I'd have expected an 'Attribute Error' or something like that as I've changed the method name. As a last resort I deleted the contents of the gen_py directory, still with no effect. So, I'm left thinking that this type lib can't or won't use the win32com magic Dispatch support and it's falling back to dynamic support. Can anyone suggest what's actually happening here, and any way forward?<br>
<br>For completeness, the entire script is:<br><br>import win32com.client<br>lr = win32com.client.Dispatch("wlrun.LrEngine")<br>lr.ShowMainWindow(True) # <- works fine, application pops up ok.<br>webVusers = lr.GetVuserTypeLicenseLimit("QTWeb") # <:-(<br>
print webVusers<br><br><br>Thanks,<br><br>Mark.<br><br><br>