下面的代码为我提供了任何窗口的所有元素,但我想知道用户访问的特定按钮/链接/文本框...
User32.INSTANCE.EnumChildWindows(GetForegroundWindow(),
new User32.WNDENUMPROC() {
int count = 1;
public boolean callback(HWND hWnd, Pointer userData) {
byte[] textBuffer = new byte[512];
User32.INSTANCE.GetClassNameA(hWnd, textBuffer, 512);
byte[] childBuffer = new byte[512];
User32.INSTANCE.GetWindowTextA(hWnd, childBuffer, 512);
return true;
}
}, null);