[python-win32] VB Com object problem

Tim Roberts timr at probo.com
Wed Mar 15 19:32:39 CET 2006


On Tue, 14 Mar 2006 07:47:35 -0800, "Gary Scorby"
<Gary.Scorby at harlandfs.com> wrote:

>I have a visual basic com object I am trying to use, so far
>unsuccessfully.  I am happily VB ignorant but will do my best to
>describe the problem.
> 
>  
>
>>>>>>> import win32com.client
>>>>>>> biff = win32com.client.Dispatch("OBName.Main")
>>>>>>> biff.LoggedIn
>>>>        
>>>>
>0
>  
>
>>>>>>> biff.TelLogin("Login", "Password", -1, App)
>>>>        
>>>>
> 
>The "TelLogin" method is where things blow up.  I need to send the
>following 4 required parameters-
>1) Login ID
>2) Password
>3) A VB True, which they tell me is equivalent to -1
>4) The VB App keyword which is suppose to identify the calling
>application, in this case Python.  This is where things blow up.
>  
>

This is an absolutely dreadful design decision on their part.  It
basically ensures that this component is Visual Basic ONLY.

The App keyword returns a COM object, which implements several
interfaces, including one that has an EXEName property.  In order for
you to provide the equivalent, you would have to create a COM server
that implements the same interfaces.  In a few minutes of Google
searching, I was not able to find out which interfaces the App object
supports.  Without that, you cannot possibly hope to satisfy this function.

(Actually, since their code is written in VB and uses the "Object" type,
you could write a COM object using IDispatch and provide just that one
property, but it's almost certainly more trouble than just using VB code.)

>Below is a description from the vendor about the App keyword and how it
>is used.  Looks very VB specific to me.  I have been all over the web
>trying to find an equivalent of what to send in Python.  I have had no
>luck.  What in the name of Python, if anything, can I use in the 4th
>parameter?  I have successfully used other VB com objects with Python,
>but never with an App requirement.
>  
>

No.  It was a stupid thing to do.  If they wanted the executable name,
they should have had you pass it in as a string parameter.  As it is,
you are stuck.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list