VB调试,尝试调用DLL中的方法并带有回调函数,报错提示:
操作符AddressOf使用无效
代码:
Private Sub btnScan_Click()
'...
WCHBLEStartScanBLEDevices AddressOf callBack
End Sub
' This function is called from the dll
Public Function callBack(ByVal pName As String, ByVal pId As String) As Long
'...
End Function
网上查询得知,callBack函数不能放在窗体代码中,需要放到单独的模块中:
重新运行不再报错。