根据我对运行时错误 438 的理解,它表明二进制兼容性问题,例如引用的 ActiveX 库与分布式库不兼容。我看不出为什么 CLng 或 Round 等基本 VB6 程序会生成此运行时错误。
Dim X as Integer
Dim Y as Single
Dim result as Long
X = GetX() ' Returns 0
Y = GetY() ' Returns 0.75
result = CLng(X / Y) ' throws runtime error 438
result = Round(X / Y) ' throws runtime error 438
我在这里缺少什么明显的东西吗?
编辑:
我已经确认问题出在项目中,而不是代码中。这个错误/情况似乎是通用电气 Proficy iFIX 8.1 提供的开发环境特有的一个怪癖。
From what I understand about runtime error 438, it indicates binary compatibility problems like a referenced ActiveX library is not compatible with the distributed library. I can see no reason why this runtime error would be generated for basic VB6 procedures like CLng
or Round
.
Dim X as Integer
Dim Y as Single
Dim result as Long
X = GetX() ' Returns 0
Y = GetY() ' Returns 0.75
result = CLng(X / Y) ' throws runtime error 438
result = Round(X / Y) ' throws runtime error 438
Is there something obvious I'm missing here?
EDIT:
I have confirmed that the problem lies in the project, not the code. It seems that this error/situation is a quirk specific to the development environment offered by General Electric's Proficy iFIX 8.1.
发布评论
评论(2)
我刚刚在 vb6 中尝试了你的代码,效果很好。
您在帖子中提到了 2 个错误:438 和 483。
VB6 帮助对这些错误提供了以下描述:
对象不支持此属性或方法(错误 438)
打印机驱动程序不支持指定的属性(错误 483)
我可以看不到这些错误是如何引发的
I just tried out your code in vb6 and it worked fine.
You mention 2 errors in your post, 438 and 483.
VB6 help gives the following descriptions for those errors:
Object doesn't support this property or method (Error 438)
Printer driver does not support specified property (Error 483)
I can't see how either of those errors are being raised
对 Single 进行整数除法将返回一个整数。您的变量“结果”被声明为 long 。对于整数除法,您还应该使用另一个斜杠(\)。
Integer division against a Single will return an integer. Your variable "result" is declared as long. With Integers in division, you should use the other slash ( \ ) also.