I&#39;m trying to drive an application via it&#39;s COM interface but I am having trouble with ByRef parameters.<br><br>The method I&#39;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(&quot;userType&quot;)<br><br>gives me:<br><br>com_error: (-2147352561, &#39;Parameter not optional.&#39;, 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>        &quot;&quot;&quot;Get the License limit for the Vuser Type &quot;&quot;&quot;<br>        return self._oleobj_.InvokeTypes(8, LCID, 1, (3, 0), ((8, 1), (16387, 0)),strVuserType<br>
            , pRetLimit)<br><br>and it still didn&#39;t change anything! I&#39;d have expected an &#39;Attribute Error&#39; or something like that as I&#39;ve changed the method name. As a last resort I deleted the contents of the gen_py directory, still with no effect. So, I&#39;m left thinking that this type lib can&#39;t or won&#39;t use the win32com magic Dispatch support and it&#39;s falling back to dynamic support. Can anyone suggest what&#39;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(&quot;wlrun.LrEngine&quot;)<br>lr.ShowMainWindow(True) # &lt;- works fine, application pops up ok.<br>webVusers = lr.GetVuserTypeLicenseLimit(&quot;QTWeb&quot;) # &lt;:-(<br>
print webVusers<br><br><br>Thanks,<br><br>Mark.<br><br><br>