On Fri, 23 Jun 2006 07:12:03 +0200, Frank G?nther <[EMAIL PROTECTED]> wrote:

> 
>
>I found a strange behaviour when I use a python-COM-Server together with VB.
>  
>

Not VB, but rather VBS.  They are two rather different languages.

>It seems that the first argument of a COM-Method that is passed by a
>VB-variable is set to VB-Nothing after the Method call.
>  
>

Actually, it is set to whatever is returned from the method.  You happen
to return None, which VBS translates to a Nothing.  If you change it to
return something, like a string, that's what you'll see in your VBS script.

>For example if I use the code below: After calling 
>
>testSrvObj.SetValue what, value
>
>what is deleted, but not value. But after calling
>
>            testSrvObj.SetValue "ABC", value
>
>value is deleted.
>
>Has anybody an idea what is the problem?
>  
>

This is just a VBS weirdness when calling COM methods.  Calling your COM
server from Python works perfectly, and turning on the debug tracing
shows nothing unusual.  It gets two input parameters that are not modified.

VBS does have some strange rules about COM method calls and return
values.  You can eliminate this problem by having your VBS code fetch
the return value:

  WScript.Echo testSrvObj.SetValue( what, value )
  WScript.Echo testSrvObj.SetValue( "ABC', value )
--or--
  retvalue = testSrvObj.SetValue( what, value )
  retvalue = testSrvObj.SetValue( "ABC', value )

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to