使用Foo(...,[out] BSTR * value)从VBScript调用COM方法 [英] calling COM method with Foo(..., [out] BSTR * value) from VBScript

查看:136
本文介绍了使用Foo(...,[out] BSTR * value)从VBScript调用COM方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用签名

 HRESULT Foo(BSTR in, [out] BSTR * out1, [out] BSTR * out2)

来自VBScript?

from VBScript?

以下内容:

 Dim a;
 Dim b;
 component.Foo "something", a, b

提供有关不兼容类型的错误。

gives an error about incompatible types.

我仍然可以更改方法的签名。

I still could change the signature of the method.

推荐答案

看起来不支持输出参数; ByRef / [in,out] 参数,但只在 VARIANT 参数。

Looks like output parameters are not supported; while ByRef / [in, out] parameters are, but only on VARIANT parameters.

从以下知识库文章:

信息:当您将参数从ASP组件传递到Visual Basic Component @ support.microsoft.com时,类型不匹配错误

VBScript只支持VARIANT ByRef参数,你可以使用VBScript调用一个ByRef字符串的过程,但是使用Visual Basic构建的组件的默认行为是失败,当尝试将ByRef参数传递到这些组件时,错误OLE自动化的默认类型强制函数在被要求将ByRef变体转换为任何其他ByRef类型时失败。

"VBScript only supports VARIANT ByRef parameters. You can use VBScript to call a procedure that takes ByRef strings, but the default behavior of components built with Visual Basic is to fail with a type mismatch error when trying to pass ByRef parameters to these components. OLE Automation's default type-coercion function fails when asked to convert a ByRef variant into any other ByRef type."

此外,以下是有关此主题的其他链接:

Also, here are other links on the topic:

In,Out,In-Out,Make up your mind已经@ MSDN博客

VBScript类型不匹配问题与[in,out] BSTR *参数SO问题

这篇关于使用Foo(...,[out] BSTR * value)从VBScript调用COM方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆