类型不匹配错误VbSCript。 [英] Type mismatch Error VbSCript.
本文介绍了类型不匹配错误VbSCript。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个c ++ COM dll,我试图通过vbscript访问它。对象创建得很好,但始终显示错误类型不匹配:函数名称
VB脚本代码 -
I have a c++ COM dll which i am trying to access through the vbscript. The Object is created just fine but always shows the error "type mismatch: function name"
VB SCRIPT CODE-
d dim obj1
set obj1=CreateObject("Begineers.first")
Dim lngReturnValue
Dim a
a=5
Dim b
b=7
obj1.AddNumbers a, b, lngReturnValue
Wscript.Echo( "The value of a+b is: " & lngReturnValue)
Set obj1 = Nothing
c ++ dll中的函数 -
Functions in c++ dll -
STDMETHODIMP Cfirst::AddNumbers(LONG Num1, LONG Num2, LONG* ReturnVal)
{
// TODO: Add your implementation code here
*ReturnVal = Num1 + Num2;
return S_OK;
}
推荐答案
一种可能性......
VB(脚本)可能会抱怨输出/延迟的类型LONG *
你没有显示你的idl,所以我看不出方法是如何声明的
但它可能值得使用结果的变体,例如
[out,retval] VARIANT * retval
One possibility...
VB (script) might be complaining about the type LONG* for an out/retval
You don't show your idl, so I can't see how the method is declared
But it might be worth using a variant for the result, e.g.
[out, retval] VARIANT* retval
这篇关于类型不匹配错误VbSCript。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文