
You might use "FindWindow"/"FindWindowEx" to locate your control or use "WindowFromPoint" if that makes sense. Depending on how your application UI is designed (if it has a UI that is) there are a couple of different ways that you can use to get this handle. Seems it would be better when the macro failed to leave the mouse where it is.For reading text content from another application's text box you will need to get that text box control's window handle somehow. For example, PaperPort 11 can have a focus on a particular folder, and Quattro Pro on a particular cell, but the above macro has no effect but to jump the mouse to the top left corner of the screen. Apparently, some programs don't have a "cursor" or "caret", even though there is an indicator in the programs as to what it is focused on. The mouse will move to the top left corner when the macro fails. I notice that even thought I commented out the line "if( 20 >. SendEvent moving the cursor back to it's original position guiInfo is a structure variable of type GUIThreadInfo that is required by GetGUIThreadInfo() method of user32.dll. GetCaretPosition() method populates GUI Thread information into guiInfo object. Tooltip can be moved by pressing the left mouse button and moving the cursor onto it. Now open Microsoft Word and see the Tooltip re-appear.Now click on Desktop, Tooltip disappears.When Notepad window reaches the edge of screen, Tooltip changes its position (By default, it gets displayed at the bottom right to the caret).Now move the Notepad window and observe the continuously changing caret position inside tooltip.While typing, Tooltip moves along with caret. To test the caret postion, just run the application and follow the process below: You can enhance the UI or add some more information. Facing the same client and non client region problem, I spent some time looking for the possible solution and arrived at this approach. This association leads to wrong information about caret position inside Microsoft Office 2007 like products where the entire window results as the client area. Though there are many ways to get the caret position inside an application, the problem is that those methods are associated with the client region and non client regions and provide/use wrong handles.


The source code, attached here, is fully illustrative and easy to understand. (Here the other application is an entirely different process and not connected in any way with our application.) This article describes how to show a tooltip window next to the caret in any application. Sometimes we need to know about the caret position inside another application for various purposes like showing Tooltip or message window along with caret.
