java jna调用dll文件_关于java jna调用dll的问题
public interface User32 extends StdCallLibrary
{
User32 INSTANCE = (User32)Native.loadLibrary("User32",User32.class);//加載系統User32 DLL文件,也可以是C++寫的DLL文件
int SendMessageA(int hwnd,int msg,int wparam,int lparam);
int FindWindowA(String arg0,String arg1);
void BlockInput(boolean isBlock);
int MessageBoxA(int hWnd,String lpText,int lpCaption,int uType);
}
public static void main(String[] args) throws Exception
{
int hwnd = User32.INSTANCE.FindWindowA(null, null);
System.setProperty("jna.encoding","GBK");//設置編碼,防止亂碼
User32.INSTANCE.MessageBoxA(0, "看我閃瞎你的狗眼", 0, 0);//調用消息對話框
// User32.INSTANCE.SendMessageA(49176,use, 0, 0);
User32.INSTANCE.BlockInput(true);//阻塞鼠標鍵盤的輸入
// User32.INSTANCE.SendMessageA(hwnd, 0x0112, 0xF170, 2);//關閉顯示器
Thread.sleep(2000);//間隔2秒
// User32.INSTANCE.SendMessageA(hwnd, 0x0112, 0xF170, -1);//打開顯示器
Thread.sleep(2000);//間隔2秒
// User32.INSTANCE.SendMessageA(3278802,0x08,0,0);
我的代碼如上,SendMessage里面的參數 我怎么知道什么代表什么? 然后我在網上找到的資料人家都是以 函數都是 VM_CLICK 這種形式的,但是我為什么沒有呢?
總結
以上是生活随笔為你收集整理的java jna调用dll文件_关于java jna调用dll的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 审计署计算机培训心得体会,审计署计算机中
- 下一篇: 1380C. Create The Te