0

I am working on a program that will allow the user to record steps of simple tasks and then generate a file to send to people that show these steps. So if you left click on a window it will say "User Left Clicked on Google Chrome" with an appropriate screenshot and highlighted cursor for visbility.

I am using Java Native Hook Found here for the global mouse/key listeners and Java Native Access Found here to get the title of the application that is clicked.

I would like to include something that highlights an area where text is entered. At the moment I am thinking of taking a screenshot when the user clicks a textbox and then storing all the keys that are pressed (for the guide) and taking a second screenshot after the text has been input, and also adding a highlight outline around the text.

I feel like it would be easier to generate the highlighting if I could get the location of the caret but i'm not exactly sure how to do this for global applications.

technomage
  • 9,861
  • 2
  • 26
  • 40
Kraizee
  • 31
  • 2
  • 7
  • So what you _really_ want to do is determine some bounds for an area where text is being entered (either the text component itself, or some smaller region)? You might want to refine your question title... – technomage Sep 21 '15 at 17:21
  • @technomage If there is a way to determine the bounds for a text component then I'm all ears. I hadn't thought of that, just figured that if you could get the cursor location, there is probably a way to get the caret location but so far I haven't found anything of use. – Kraizee Sep 22 '15 at 07:48
  • If you can get the `HANDLE` to the [edit control](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775458(v=vs.85).aspx), you should be able to query for its bounds using [`GetWindowRect()`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx) and [`GetClientRect()`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633503(v=vs.85).aspx). – technomage Sep 22 '15 at 13:06
  • @technomage So I'm already using the following to get the window title, and bounds for the entire window `HWND hwnd = User32.INSTANCE.GetForegroundWindow(); User32.INSTANCE.GetWindowText(hwnd, buffer, 1024); System.out.println("Active window title: " + Native.toString(buffer)); RECT rect = new RECT(); User32.INSTANCE.GetWindowRect(hwnd, rect);` How exactly would i get the handle for the edit control? I also don't seem to have GetClientRect() available. – Kraizee Sep 22 '15 at 13:44
  • Try http://stackoverflow.com/questions/23369951/finding-handle-for-edit-control. – technomage Sep 22 '15 at 14:35

0 Answers0