我要用java 调用jawin 读取 dll 来实现读取硬盘编号目的
以下是原代码
package com.ywda.util;
import org.jawin.COMException;
import org.jawin.FuncPtr;
import org.jawin.ReturnFlags;
public class nativeDll {
public static void main(String[] args) throws Exception {
int result1,result2;
FuncPtr test1 = null;
FuncPtr test2 = null;
try {
test1 = new FuncPtr("demo.dll", "test1");
test2 = new FuncPtr("demo.dll", "test2");
result1 = test1.invoke_I(5, 6, ReturnFlags.CHECK_NONE);
result2 = test2.invoke_I(5, 6, ReturnFlags.CHECK_NONE);
System.out.println("5 plus 6 is " + result1);
System.out.println("5 multiply 6 is " + result2);
} catch (COMException e) {
e.printStackTrace();
} finally {
if (test1 != null) {
try {
test1.close();
} catch (COMException e) {
e.printStackTrace();
}}
if (test2 != null) {
try {
test2.close();
} catch (COMException e) {
e.printStackTrace();
}}}}}
这段代码是我从网上找的,不好使,我也不知道该怎么改,还有救市dll 文件到底要放在什么地方,有没有人知道怎么写。
这是错误代码
org.jawin.COMException: 8007007e: ???????¨
at org.jawin.Bootstrap.loadLibrary(Native Method)
at org.jawin.FuncPtr.(FuncPtr.java:79)
at com.ywda.util.nativeDll.main(nativeDll.java:18)