/*
* HelloDll.java -
*
* This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
*
* Please consult the LICENSE file in the project root directory,
* or at the project site before using this software.
*/
/* $Id: HelloDll.java,v 1.3 2004/06/14 20:16:38 arosii_moa Exp $ */
package demos;
import org.jawin.COMException;
import org.jawin.FuncPtr;
import org.jawin.ReturnFlags;
/**
* Demo that uses the Win32 MessageBoxW API-method.
*
* @version $Revision: 1.3 $
* @author Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
*/
public class HelloDll {
public static void main(String[] args) throws Exception {
FuncPtr msgBox = null;
try {
msgBox = new FuncPtr("USER32.DLL", "MessageBoxW");
msgBox.invoke_I(0, "Hello From a DLL", "From Jawin", 0, ReturnFlags.CHECK_FALSE);
} catch (COMException e) {
// handle exception
e.printStackTrace();
throw e;
} finally {
if (msgBox != null) {
try {
msgBox.close();
} catch (COMException e) {
// handle fatal exception
e.printStackTrace();
throw e;
}
}
}
}
}
|
相关推荐
本篇文章小编给大家整理了java调用dll的方法的总结,有需要的朋友参考学下一下吧。
在Java中调用DLL(Dynamic Link Library)文件,可以使用Java的本地方法接口(JNI,Java Native Interface)来实现。JNI允许Java程序与本地代码进行交互,从而实现跨平台的功能。
用到的资源在压缩包里都有; 环境win7 64位 1.6jdk ;vs c++ 生成64位 dll jni 在C:\Program Files\Java\jdk1.6\include
This document is the API specification for the JNA library for simplified native library access for Java.
JAVA使用JNative包调用DLL文件
java 调用dll 最简单的方式,完全不用开发c++代码,简单易用。
java 调用dll In this tutorial, I will try to explain how to call native functions which are written in C or C++ from Java, using JNI.
该资源详细介绍了java调用dll方法和里面需要注意的一下注意事项,希望这个资源能帮助到大家,大家共同学习进步!
java调用dll接口,备份供大家察看,谢谢大家共享。
Java调用DLL源代码JNA和JNative
Java调用dll实例,这里包含了jacob+jawin+jna+jnative方法在内的各种资源以及demo,有许多都是CSDN中的下载资源。由于本人也是新手,为了下载关于调用dll的相关资源消耗了大量积分,特此将手中资源进行汇总,为了方便...
java调用DLL实例程序,使用的是开源JNative调用