Java中调用Windows API的方法
来源:互联网 发布:淘宝店铺绑定旺旺 编辑:程序博客网 时间:2024/05/01 07:10
Java中调用Windows API的方法
要在Java中调用Windows API,最简单的方法就是使用JNative.jar中提供的接口。该库已经对Linux和Windows系统中的API进行了封装,例如对Windows,使用它里面的接口调用就和在Delphi等开发工具中的调用方法是一样的,因为函数的名字和参数都是一样的。下面说明其用法。
安装方法:将JNative.jar加到classpath中即可。
假如现在要给QQ的窗口发送消息,程序如下:
import org.junit.Test;
import org.xvolks.jnative.misc.basicStructures.HWND;
import org.xvolks.jnative.misc.basicStructures.LPARAM;
import org.xvolks.jnative.misc.basicStructures.UINT;
import org.xvolks.jnative.misc.basicStructures.WPARAM;
import org.xvolks.jnative.util.User32;
public class JNativeLearning {
@Test
public void sendMessage() throws Exception {
HWND hWnd=User32.FindWindow("TXGuiFoundation", "QQ2010");
if(hWnd.getValue()>0){
System.out.println("窗口存在");
User32.SendMessage(hWnd, new UINT(0x10), new WPARAM(0), new LPARAM(0));
}else{
System.out.println("窗口不存在");
}
}
}
其它接口请参见其JavaDoc:http://jnative.free.fr/docs/
- Java中调用Windows API的方法
- Java中调用Windows API的方法
- Java中怎么调用Windows的API
- c#调用Windows API函数的方法
- MFC调用Windows API的方法
- C#调用windows API的一些方法
- java调用windows API
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- C#中调用Windows API的要点
- vscode快捷键大全
- 面试题
- 实时监控textview输入的方法
- Android Studio开发环境建立aidl文件,生成相应的java文件
- Android模拟登陆综合教务系统客户端(java)-jsoup解析数据
- Java中调用Windows API的方法
- iOS 横屏的问题,相信很多新手朋友都是懵懵懂懂
- 数据结构与算法JavaScript - 二叉树和二叉查找树
- spring boot入门 (3)--Maven 打包
- Servlet常见错误及解决方法
- hokuyo 01LX激光传感器驱动程序的安装和创建地图时出现的问题
- 代码笔记
- android插件化学习笔记(二)
- POJ 1321棋盘问题