|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
下面代码执行后,出现VarPtr(value(0))下标越界。
怎样调用 BLC_getSignalValue获取信号值
Private Declare PtrSafe Function iBLC_getSignalValue _
Lib "BabyLIN64.dll" Alias "BLC_getSignalValue" ( _
ByVal handle As LongPtr, _
ByVal signalNr As Long, _
ByVal P_value As LongPtr) As Long
Public Function BLC_getSignalValue( _
ByVal handle As LongPtr, _
ByVal signalNr As Long, _
ByRef value() As Long) As Long
Dim rv As Long
rv = iBLC_getSignalValue(handle, signalNr, ByVal VarPtr(value(0)))
' swap high and low -> little-endian
Call Swap_Long(value)
BLC_getSignalValue = rv
End Function
Sub a()
Dim MyRead As Long, MyVa() As Long
res = BabyLIN.BLC_getSignalValue(linChannelHandle, MyRead, MyVal)
End Sub
|
|