使用JNA 调用WINDOWS API
来源:百度文库 编辑:神马文学网 时间:2024/04/30 17:05:05
在我接触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);
}
调用的方式为:public class MainDemo ...{ public static void main(String[] args) ...{
Kernel32 lib = Kernel32.INSTANCE;
byte[] buffer2=new byte[100];
lib.GetLogicalDriveStringsA(buffer2.length/2,buffer2);
for(byte bt : buffer2)
...{
System.out.print((char)bt);
}
System.out.println(); byte[] buffer = new byte[50]; lib.GetSystemDirectoryA(buffer, 50);
for(byte bt : buffer)
...{
System.out.print((char)bt);
}
}
}本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhangjianying/archive/2008/01/25/2064911.aspx
int GetLogicalDriveStringsA(int length,byte[] buffer);
int GetSystemDirectoryA(byte[] buffer,int size);
}
调用的方式为:public class MainDemo ...{ public static void main(String[] args) ...{
Kernel32 lib = Kernel32.INSTANCE;
byte[] buffer2=new byte[100];
lib.GetLogicalDriveStringsA(buffer2.length/2,buffer2);
for(byte bt : buffer2)
...{
System.out.print((char)bt);
}
System.out.println(); byte[] buffer = new byte[50]; lib.GetSystemDirectoryA(buffer, 50);
for(byte bt : buffer)
...{
System.out.print((char)bt);
}
}
}本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhangjianying/archive/2008/01/25/2064911.aspx
使用JNA 调用WINDOWS API
在Webpage上调用Windows Messenger API
C#中调用Windows API的要点
在Webpage上调用Windows Messenger API
Windows API函数使用技巧
Windows Socket API 使用经验
使用调用外部程序函数实现API函数高级功能
extern \调用系统API
WINDOWS API
VB vfp中调用API函数创建和使用逻辑字体
什么是Windows API
什么是Windows API
windows api函数:OpenSCManager
Visual Basic中调用MSN API函数
基础类的DSP/BIOS API调用
基础类的DSP/BIOS API调用
WINDOWS API 程序设计(第一章:开始)
Windows API函数大全2
Windows API函数大全一
Windows API函数大全二
Windows API函数大全四
Windows下Hook API技术
Windows API函数大全2
Windows API函数大全四