Click here to Skip to main content
15,891,745 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:

Java
GetWindowTextW(GetForegroundWindow(), buffer, MAX_TITLE_LENGTH);

and process name :

Java
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.
Posted
Updated 21-Oct-13 20:42pm
v3
Comments
Sergey Alexandrovich Kryukov 21-Oct-13 1:01am    
Great. Please go ahead and do it, you got my permission.
—SA
Member 10286395 21-Oct-13 5:39am    
:)

1 solution

You will need to enumerate all the windows, and for each window you will need to enumerate all the child windows, and for each child window you will need to enumerate all its child windows, etc. I don't know how you would do this in Java, but in C++ you should look at http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx[^], and its associated functions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900