jacob com.jacob.com.ComFailException:无法将名称映射到 dispid:CardNumber[0] git hub ZkemSDK 项目
jacob com.jacob.com.ComFailException: Can't map name to dispid: CardNumber[0] git hub ZkemSDK project
我在做门禁考勤机对接项目
我发现这个项目使用 github 中的 java 连接到同一类型
但是在我想设置 CardNumber 属性 的那一行我有一个例外
"com.jacob.com.ComFailException: Can't map name to dispid: CardNumber[0]"
有人能帮帮我吗
https://github.com/lookskystar/ZKKQProject/blob/master/ZKKQProject/src/com/zkkq/uitl/ZkemSDK.java
public class ZkemSDK
{
private static ActiveXComponent zkem ;
public ZkemSDK(){
zkem = new ActiveXComponent("zkemkeeper.ZKEM.1");
System.out.println("done ");
}
public boolean connect(String address,int port, int machineNum) throws Exception{
boolean result = zkem.invoke("Connect_NET",address,port).getBoolean();
}
public boolean SetUserInfo(int machineNum,int enrollNo2,String userName,String password,int privelage ,boolean flag) {
Variant dwUserName = new Variant(userName,true);
Variant dwPassword = new Variant(password,true);
Variant dwPrivelage = new Variant(privelage,true);
Variant dwEnrollNo = new Variant(enrollNo2,true);
Variant dwMachineNum= new Variant(machineNum,true);
/****/
zkem.setProperty("CardNumber[0]",454545);
/****/
Variant vResult = Dispatch.call(zkem,"SetUserInfo",dwMachineNum, dwEnrollNo, dwUserName, dwPassword, dwPrivelage,true);
return true;
}
}
我发现有人重写了 setProperty 以便能够添加数组
在这个 link
我的代码是这样
public static void setProperty(Dispatch d, String sName, String sIndex, String sValue) {
Variant av[] = { new Variant(sIndex), new Variant(sValue) };
int j[]= {0};
Dispatch.invokev(d, sName, Dispatch.Put, av,j).safeRelease();
av[0].safeRelease(); av[1].safeRelease();
}
通话是这样的
this.setProperty(zkem,"CardNumber","0","2599970");
在这一行之前
Variant vResult = Dispatch.call(zkem,"SetUserInfo",dwMachineNum, dwEnrollNo, dwUserName, dwPassword, dwPrivelage,true);
我在做门禁考勤机对接项目 我发现这个项目使用 github 中的 java 连接到同一类型 但是在我想设置 CardNumber 属性 的那一行我有一个例外 "com.jacob.com.ComFailException: Can't map name to dispid: CardNumber[0]" 有人能帮帮我吗
https://github.com/lookskystar/ZKKQProject/blob/master/ZKKQProject/src/com/zkkq/uitl/ZkemSDK.java
public class ZkemSDK
{
private static ActiveXComponent zkem ;
public ZkemSDK(){
zkem = new ActiveXComponent("zkemkeeper.ZKEM.1");
System.out.println("done ");
}
public boolean connect(String address,int port, int machineNum) throws Exception{
boolean result = zkem.invoke("Connect_NET",address,port).getBoolean();
}
public boolean SetUserInfo(int machineNum,int enrollNo2,String userName,String password,int privelage ,boolean flag) {
Variant dwUserName = new Variant(userName,true);
Variant dwPassword = new Variant(password,true);
Variant dwPrivelage = new Variant(privelage,true);
Variant dwEnrollNo = new Variant(enrollNo2,true);
Variant dwMachineNum= new Variant(machineNum,true);
/****/
zkem.setProperty("CardNumber[0]",454545);
/****/
Variant vResult = Dispatch.call(zkem,"SetUserInfo",dwMachineNum, dwEnrollNo, dwUserName, dwPassword, dwPrivelage,true);
return true;
}
}
我发现有人重写了 setProperty 以便能够添加数组
在这个 link
public static void setProperty(Dispatch d, String sName, String sIndex, String sValue) {
Variant av[] = { new Variant(sIndex), new Variant(sValue) };
int j[]= {0};
Dispatch.invokev(d, sName, Dispatch.Put, av,j).safeRelease();
av[0].safeRelease(); av[1].safeRelease();
}
通话是这样的
this.setProperty(zkem,"CardNumber","0","2599970");
在这一行之前
Variant vResult = Dispatch.call(zkem,"SetUserInfo",dwMachineNum, dwEnrollNo, dwUserName, dwPassword, dwPrivelage,true);