|
楼主 |
发表于 2020-6-19 12:15:01
|
显示全部楼层
我基本搞定了 虽然有些不理解 但好歹用上dll了
其中UserKit是dll名称,clsRC4是dll工程中的模块,EncrytString和DecrytString是加解密的方法,每个方法有两个参数:一个是原文(密文),一个是密钥。
当然我做的过程对于Dispatch和Variant对象还不是很理解。
package jacob;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.*;
public class Kit {
public static void main(String args[]){
ActiveXComponent app = new ActiveXComponent("UserKit.clsRC4");
Dispatch mycom = (Dispatch)app.getObject();
String s[] = new String[2];
s[0] = new String("ttt");
s[1] = new String("admin");
Variant result = Dispatch.callN(mycom, "EncryptString", s);
System.out.print(result);
String es[] = new String[2];
es[0] = new String("M2t");
es[1] = new String("admin");
Variant dresult = Dispatch.callN(mycom, "DecryptString",es);
System.out.print(dresult);
}
} |
|