Coroutine for Java is a good alternative.http://www.nevaobject.com/_docs/_coroutine/coroutine.htmCorouting for java class library provides the mechanism for Java to call external functions exported from Windows dynamic link libraries. Coroutine also enables you to dynamically build callable wrappers around Java methods so external functions can call Java methods as if they are native functions.Coroutine shields you from dealing with Java-To-Native-Interface (JNI,RNI, JRI) details. With Coroutine you don't need to write intermediate C++ wrappers. Coroutine for Java is the only tool that you need to integrate access to Win32 and custom APIs into your Java code. Coroutine was designed to help developers who want to incorporate Windows features and functions into Java code. Coroutine for Java supports all existing Win32-based Java Virtual Machines.Here is Coroutine for Java API reference. Using Coroutine for Java
An instance of Coroutine represents a function exported from a DLL. The Coroutine contains the name of the shared dynamic link library where the function can be found and the function’s name.To access an external function using Coroutine, perform the following four steps: Instantiate a Coroutine and initialize it with the proper library and function names: Coroutine api=new Coroutine ("KERNEL32", "Beep");
Build function’s parameter list using various addArg() methods: api.addArg(1770);
api.addArg(999);
Invoke the Coroutine using the invoke() method: if(0 !== api.invoke()) {
// Error
System.out.println("Error in invoke "+api.lastError());
}
Retrieve function's return value and/or values returned via function’s outbound parameters: if(api.answerAsBoolean()) {
...
}
Selecting between ANSI/Unicode version of Win32 API
In Win32, function’s exported name may include an uppercase A or W at the end to indicate ANSI or Unicode version of an API.
An instance of Coroutine represents a function exported from a DLL. The Coroutine contains the name of the shared dynamic link library where the function can be found and the function’s name.To access an external function using Coroutine, perform the following four steps: Instantiate a Coroutine and initialize it with the proper library and function names: Coroutine api=new Coroutine ("KERNEL32", "Beep");
Build function’s parameter list using various addArg() methods: api.addArg(1770);
api.addArg(999);
Invoke the Coroutine using the invoke() method: if(0 !== api.invoke()) {
// Error
System.out.println("Error in invoke "+api.lastError());
}
Retrieve function's return value and/or values returned via function’s outbound parameters: if(api.answerAsBoolean()) {
...
}
Selecting between ANSI/Unicode version of Win32 API
In Win32, function’s exported name may include an uppercase A or W at the end to indicate ANSI or Unicode version of an API.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货