使用JNA 调用WINDOWS API
在我接触JNA之前一直以为调用本地链接库函数的时候一定要借助JNI或者SWT来实现,一日中无意看到JNA,发现它也可以实现这类调用,于是下回来按网站上的例子试试了 还不错,因此还有点兴趣了,于是又自己写了 2个发挥了一下。
GetLogicalDriveStringsA【获取本地系统逻辑盘符】
GetSystemDirectoryA 【获取系统目录】
public interface Kernel32 extends Library {
Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
int GetLogicalDriveStringsA(int length,byte[] buffer);
int GetSystemDirectoryA(byte[] buffer,int size);
}
Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
int GetLogicalDriveStringsA(int length,byte[] buffer);
int GetSystemDirectoryA(byte[] buffer,int size);
}
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: 远程桌面连接操作windowns系统搭建java项目运行环境
- 下一篇: Java Swing学习笔记
copyright © 2008-2019 亿联网络 版权所有 备案号:粤ICP备14031511号-2