问题描述
我正在尝试在java中创建一个类似于spy ++的应用程序,其中我遇到问题是获取我正在抓取鼠标的每个元素的类/句柄/标题。
如果我们在任务栏上移动鼠标,间谍工具会显示以下信息:句柄:000100AA标题:运行应用程序类:MSTaskListWClass
如果我们将鼠标放在Windows计算器的一个按钮上(比方说1)间谍工具将显示标题:1类:按钮
我已经获得前景窗口,代码如下:
I am trying to create an app similar to spy++ in java, in which I getting problem to fetch class/handle/caption of every element which I am taking mouse over.
If we move mouse on task bar, the spy tool shows the info as : Handle : 000100AA Caption : Running applications Class : MSTaskListWClass
If we take mouse on one of the button of windows calculator(lets say "1") spy tool will show caption : 1 class:button
I m already getting foreground window with following code:
GetWindowTextW(GetForegroundWindow(), buffer, MAX_TITLE_LENGTH);
和进程名称:
and process name :
Pointer process = OpenProcess(PROCESS_QUERY_INFORMATION
| PROCESS_VM_READ, false, pointer.getValue());
GetModuleBaseNameW(process, null, buffer1, MAX_TITLE_LENGTH);
但是我仍然无法获得按钮/文本框的标题和类。请帮忙做同样的事。
But i am still not able to get captions and classes for buttons/textboxes. Please help to do the same.
推荐答案
这篇关于如何在java中获取所有windows元素的class / caption / handle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!