liub1979 发表于 2006-9-15 19:47:00

表达式太复杂???

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