On Mon, 26 Jun 2006 13:40:47 +0200, Frank G?nther <[EMAIL PROTECTED]> wrote:

>...
>
>Hi Tim, 
>
>Thanks for your answer. 
>Actually the same problem arises if you use VB or VBA. So the difference
>between VB and VBS is at least for this problem not to wide.
>  
>

This has been nagging at me all morning.  I can't find any documentation
at all that refers to this behavior, and I've gone through at least two
dozen articles on late binding in VB and VBS.  The behavior cannot be
duplicated in C#, because C# doesn't do the automatic late binding.  You
have to invoke the lower-level APIS directly.  I was able to call the
component from C#, but because it is up to me to handle the return
value, the same problem does not occur.

I did learn that you can work aroundthis issue by using parens in the
VB/VBS code:

    Dim testSrvObj, what, value, retvalue
    Set testSrvObj = CreateObject("TestSrv.Application")
     
    value = "ABCValue"
    what = "ABC"
     
    WScript.Echo "What", what
    WScript.Echo "Value", value
    testSrvObj.SetValue (what), (value)
    WScript.Echo "What", what
    WScript.Echo "Value", value
    testSrvObj.SetValue "ABC", (value)
    WScript.Echo "What", what
    WScript.Echo "Value", value
    retvalue = testSrvObj.GetValue("ABC")
    WScript.Echo "What", what
    WScript.Echo "Value", value
    WScript.Echo "Return", retvalue

-- 
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