预览加载中,请您耐心等待几秒...
1/5
2/5
3/5
4/5
5/5

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

JAVADLL控件调用 2011-05-2516:33:03|分类:HYPERLINK"http://szvortex.blog.163.com/blog/"\l"m=0&t=1&c=fks_084065092082084068080087085095083086084074084083087075"\o"java"java|标签:|字号大中小订阅 packagecom.dll; importorg.xvolks.jnative.*; importorg.xvolks.jnative.Type; importorg.xvolks.jnative.exceptions.*; importorg.xvolks.jnative.pointers.*; importorg.xvolks.jnative.pointers.memory.*; publicclassAppSvrTestConnect{ publicStringdllName="c:\\windows\\system32\\shrf32wb.dll"; //publicStringdllName="c:\\windows\\system32\\testdll.dll"; publicPointerpn; publicAppSvrTestConnect(){ } publicintinit_com(intcom) throwsNativeException,IllegalAccessException{ JNativen=null; try{ n=newJNative(dllName,"init_com");//创建JNative对象 n.setRetVal(Type.INT);//设置返回值类型 inti=0; n.setParameter(i++,Type.INT,""+com);//设置参数 System.out.println("Afterinvokedll.com="+com); n.invoke();//执行 System.out.println("Afterinvokedll.RetVal="+n.getRetVal()); returnInteger.parseInt(n.getRetVal());//获取返回值 }finally{ //if(n!=null) //n.dispose(); } } publicintdes_psd(Stringpassword) throwsNativeException,IllegalAccessException{ JNativen=null; try{ n=newJNative(dllName,"des_psd");//创建JNative对象 n.setRetVal(Type.INT);//设置返回值类型 inti=0; pn=newPointer(MemoryBlockFactory.createMemoryBlock(100)); //pn.setStringAt(0,passwordn); Pointerpd=newPointer(MemoryBlockFactory.createMemoryBlock(100)); pd.setStringAt(0,password); n.setParameter(i++,pn.getPointer());//设置参数 n.setParameter(i++,pd.getPointer());//设置参数 System.out.println("Beforeinvokedll.PN="+pn.getAsString()); System.out.println("Beforeinvokedll.PD="+pd.getAsString()); n.invoke();//执行 System.out.println("Afterinvokedll.PN="+pn.getAsString()); System.out.println("Afterinvokedll.PD="+pd.getAsString()); System.out.println("Afterinvokedll.RetVal="+n.getRetVal()); //passwordn=pn.getAsString(); //returnpd.getAsString();//获取返回值 returnInteger.parseInt(n.getRetVal()); }finally{ //if(n!=null) //n.dispose(); } } publicintwr_mach(Stringsyspwd) throwsNativeException,IllegalAccessExcep