H
html98
Unregistered / Unconfirmed
GUEST, unregistred user!
rgsabound: array[0..0] of SafeArrayBound;
arrCard: PSafeArray;
sCardDown: String;
sField: String;
j: LongInt;
i: Integer;
begin
statu := EquipDoor1.MP2000_Ini_COM(i);
i := 1;
j := 0;
rgsabound[0].lLbound := 0;
rgsabound[0].cElements := 1;
arrCard := SafeArrayCreate(VT_BSTR, 1, rgsabound);
arrCard.cbElements := 1;
arrCard.fFeatures := FADF_BSTR; //$100
sField := '7879';
sCardDown := HexValueToStr(StrToInt(sField),8) + '19' + '12' + '02' +
'1' + '0';
SafeArrayPutElement(arrCard,@j,sCardDown);
//SafeArrayGetElement(arrCard,j,sField);
//SafeArrayAccessData(arrCard,pvdata);
//sField := pvdata.Data;
statu := EquipDoor1.MP2000_Write_UserCard(i,arrCard);
//statu := Equpt.MP2000_Write_UserCard(1,arrCard);
if statu = 1 then
mmInfo.Lines.Add('Write User Machine Ok!');
statu := Equpt.MP2000_Close_COM;
if statu = 1 then
mmInfo.Lines.Add('Close Comm Ok');
end;
问题是:statu总是-1,只有是1才算写硬件成功!其它关于打开端口和关闭端口都是成功的! 我是调用了用VB写成的动态库,在Delphi中引用并安装的!
先谢谢各位专家了!谢谢!
arrCard: PSafeArray;
sCardDown: String;
sField: String;
j: LongInt;
i: Integer;
begin
statu := EquipDoor1.MP2000_Ini_COM(i);
i := 1;
j := 0;
rgsabound[0].lLbound := 0;
rgsabound[0].cElements := 1;
arrCard := SafeArrayCreate(VT_BSTR, 1, rgsabound);
arrCard.cbElements := 1;
arrCard.fFeatures := FADF_BSTR; //$100
sField := '7879';
sCardDown := HexValueToStr(StrToInt(sField),8) + '19' + '12' + '02' +
'1' + '0';
SafeArrayPutElement(arrCard,@j,sCardDown);
//SafeArrayGetElement(arrCard,j,sField);
//SafeArrayAccessData(arrCard,pvdata);
//sField := pvdata.Data;
statu := EquipDoor1.MP2000_Write_UserCard(i,arrCard);
//statu := Equpt.MP2000_Write_UserCard(1,arrCard);
if statu = 1 then
mmInfo.Lines.Add('Write User Machine Ok!');
statu := Equpt.MP2000_Close_COM;
if statu = 1 then
mmInfo.Lines.Add('Close Comm Ok');
end;
问题是:statu总是-1,只有是1才算写硬件成功!其它关于打开端口和关闭端口都是成功的! 我是调用了用VB写成的动态库,在Delphi中引用并安装的!
先谢谢各位专家了!谢谢!