3

I have a VBScript app calling COM-registered C# objects. I am able to pass in a COM object to a COM call, as well as receive either a primitive or a COM object back, but I can't do both at the same time! If I try retrieving any value back from the call while also passing in a COM object, I get the exception "Invalid procedure call or argument"

Dim foo
Set foo = Server.CreateObject("Foo")
foo.SetProperty(1)

Dim bar
Set bar = Server.CreateObject("Bar")
Dim return
Set return = bar.Do(foo)

If that last line is simply bar.Do(foo) it works fine.

Also, whether it is

Set return = bar.Do(foo)

or

return = bar.Do(foo)

causes the same error in this case.

My COM classes are classes with only methods exposed, and implementing an interface. I'm getting this error by dealing with only ints, longs, and Strings.

2 Answers 2

2

I'm a bit rusty in this area but if your method is returning an int or string shouldn't your code then read:

return = bar.Do(foo)

instead of

Set return = bar.Do(foo)
Sign up to request clarification or add additional context in comments.

1 Comment

You're correct, and I've tried both in both cases where I'm returning an object as well as an int.
0

"return = bar.Do(foo)" should work, as long as Bar.Do is actually returning something. How is Bar.Do defined?

1 Comment

It's as simple as public int Do(Foo foo) { return 1; } It's defined in an interface IBar in the same manner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.