Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Dear all,
I have research about how to use WINAPI in Java and I know that JNA is a good library for us in this.

I try to use JNA and some WINAPI function and they work well except to User32.instance.SendMessage(subwinHandle, User32.WM_GETTEXT, buffer.length, buffer );
like the way .NET developers use in VB6, C#,...

I want to get text under the mouse cursor and I can get bellow parameters:

1. Window handle of the current focus window.
2. I can get mouse pointer with x and y.


After I got above values, I call User32.instance.GetWindowTextA(winHandle, buffer, buffer.length); to retrieve the text but it always return the title of the current window.

Go through google I found that we must send directly WM_GETTEXT instead of GetWindowText but I got mistake when using SendMessage with message: "java.lang.UnsatisfiedLinkError: Error looking up function 'SendMessage': The specified procedure could not be found."


Beside that, I can not get the component (childwindow like button, lable, edit control,...) of the current window at mouse cursor.

I know about the process : get handler of the current window, find the childwindow at mouse cursor of the current window, and sendmessage,... but still got problem with this.

Can some guys give me some ideas to do this 9get text under the mouse cursor) in Java.

Regards,
Posted
Updated 19-Jul-11 20:42pm
v3
Comments
TorstenH. 20-Jul-11 2:44am    
I added more tags, this is no Java topic in general, more a Windows-OS.

Answered here[^] in the Java forum.
 
Share this answer
 
Hi sharkbc

Did you find a solution to this problem? I am also fighting to make i work...

Andrzej
 
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