JNA中:
public interface User32 extends StdCallLibrary { User32 INSTANCE = (User32) Native.loadLibrary("user32", User32.class); int GetWindowTextA(PointerType hWnd, byte[] lpString, int nMaxCount);}要使用它:
byte[] windowText = new byte[512];PointerType hwnd = ... // assign the window handle here.User32.INSTANCE.GetWindowTextA(hwnd, windowText, 512);System.out.println(Native.toString(windowText));
您可能需要为HWND使用适当的结构映射,并允许unipre支持。您可以在JNA网站上找到该信息以及更多有关如何执行此操作的示例。
MSDN上提供了GetWindowText函数的文档。
JNA的文档可从jna.dev.java.net获得。



