visa32.dll没发现设备 nmatches=0
在VB中声明以下函数
Declare Function viOpenDefaultRM Lib "VISA32.DLL" Alias "#141" (sesn As Long) As Long
Declare Function viFindRsrc Lib "VISA32.DLL" Alias "#129" (ByVal sesn As Long, ByVal expr As String, vi As Long, retCount As Long, ByVal desc As String) As Long
调用时 Call viOpenDefaultRM(defrm)
Call viFindRsrc(defrm, "USB?*", list, nmatches, matches)
能发现设备 nmatches=1
而用delphi做以下声明
function viOpenDefaultRM(var sesn: integer): Integer; stdcall;external 'visa32.dll' ;
function viFindRsrc(sesn: integer; expr: string; vi: integer; var retCount: integer; var desc: string): integer; stdcall; external 'visa32.dll';
调用时
viopendefaultrm(rm);
viFindRsrc(rm,'usb?*',list,nmatches, matches);
没发现设备 nmatches=0
function viOpenDefaultRM(var sesn: integer): Integer; stdcall;external 'visa32.dll' ;
function viFindRsrc(sesn: integer; expr: PChar; vi: integer; var retCount: integer; desc: PChar): integer; stdcall; external 'visa32.dll';
调用时
s := 'usb?*';
viopendefaultrm(rm);
viFindRsrc(rm,PChar(s),list,nmatches, PChar(matches));
提示新错误" access violation at address 631473A2 in module 'visa32.dll'.write of address 004280B4" 请指点。这是什么意思
matches定义为Array[0..254] of Char;试下
#2那个读错误,我个人认为是string处出错,因为VB的string是UNICODE,而低版本DELPHI是ANSI