Java JNA FindWindow()-查找函数'FindWindow'时出错:找不到指定的过程 [英] Java JNA FindWindow() - Error looking up function 'FindWindow': The specified procedure could not be found

查看:424
本文介绍了Java JNA FindWindow()-查找函数'FindWindow'时出错:找不到指定的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JNA来显示一个名为MyWindowTitle的窗口.

I'm trying to bring to front a window named MyWindowTitle, using JNA.

import com.sun.jna.Native;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.platform.win32.WinDef.HWND;

public class ToFront {

public static interface User32 extends StdCallLibrary {
    final User32 instance = (User32) Native.loadLibrary ("user32", User32.class);
    HWND FindWindow(String winClass, String title); 
    boolean ShowWindow(HWND hWnd, int nCmdShow);
    boolean SetForegroundWindow(HWND hWnd);

}


public static void main(String[] args) {
    HWND hwnd = User32.instance.FindWindow(null, "MyWindowTitle"); 
    User32.instance.ShowWindow(hwnd, 9); 
    User32.instance.SetForegroundWindow(hwnd); 
}

}

我收到以下异常java.lang.UnsatisfiedLinkError: Error looking up function 'FindWindow': The specified procedure could not be found.

推荐答案

检查函数的拼写.您可以使用依赖关系遍历器来查看该函数是否存在于dll中.

Check the spelling of your function. You can use dependency walker to see if that function exists in your dll.

Ps:当我打开user32.dll时,这些就是我发现的功能

Ps : when I opened user32.dll those are the functions I found

:FindWindowA,FindWindowExA,FindWindowExW,FindWindowW 

这篇关于Java JNA FindWindow()-查找函数'FindWindow'时出错:找不到指定的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆