简体   繁体   中英

Find coordinates of text on a page - c++, windows, VS2013

Is there any way to retrieve the coordinates of input text on the screen (not on the API itself) ?

Example in pseudo code:

user types: "example"

example found at [400,355] //on my screen

I have no problem checking if the input is on the screen but I have no idea how to capture the coordinates without OCR which I don't want to have to do.

My question is about webpages in particular but I would also be interested in how to do it in general (notepad text, messenger text...).

Ideas appreciated Thanks!!!

jQuery has an .position() function; however, note that the position is relative to the object's parent, and is not the absolute screen position. Though, with a bit of math you can find it.

https://api.jquery.com/position/

in C++ : Hope this could work, use this in your handler for WM_LBUTTONDOWN :

xPos = GET_X_LPARAM(lParam); 
yPos = GET_Y_LPARAM(lParam);

..................................................

As said by @user2759788 jQuery/javascript both can be used for finding coordinates on a webpage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM