期待重返发展空间;主要使用Java调用一些本机win32函数(我不想在.NET中构建)......
有人可以指出我可以使用Java(JNI / JNA / SWIG)从不同的运行窗口中读取标题的地方。假设您知道您尝试挂接的应用程序在内存空间的哪个位置。
期待重返发展空间;主要使用Java调用一些本机win32函数(我不想在.NET中构建)......
有人可以指出我可以使用Java(JNI / JNA / SWIG)从不同的运行窗口中读取标题的地方。假设您知道您尝试挂接的应用程序在内存空间的哪个位置。
在 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 使用正确的结构映射并允许 unicode 支持;您可以在JNA 网站上找到有关如何执行此操作的信息和更多示例。
GetWindowText 函数的文档可在MSDN中找到。
JNA 的文档可从jna.dev.java.net 获得