其实是很简单的一个函数调用
我用vc编了一个vb能够调用dll
程序如下
double __stdcall Distance2D(double x1 , double y1 , double x2 , double y2 ) { double distance; double a, b; a = pow(x1 - x2,2); b = pow(y1 - y2,2); distance = fabs (sqrt (a + b)); return distance; }
我在vb下调用如下
Private Declare Function Distance2D Lib "ACMTDLL" (ByVal x1 As Double, ByVal y1 As Double, _ ByVal x2 As Double, ByVal y2 As Double) As Double Sub Main() Dim d As Double d = Distance2D(0#, 0#, 1#, 1#) End Sub 可以得到正确结果
可是在vba里运行时 便出现以下错误提示
运行时错误16 表达式太复杂
不知是什么原因啊表达式很复杂吗? 有那位大虾赐教一下! |