Active window text

I'm getting handle and title of active window

1
2
HWND hwnd = GetForegroundWindow();
GetWindowText(hwnd, wnd_title, sizeof(wnd_title));


How I can read all text from active window? (for example, html from browser active window?

Thanks
"Read all text" is too ambiguous of a statement.
If you are trying to get text from HTML on the internet, I suggest using a library like cURL (libcurl).
https://curl.haxx.se/libcurl/c/example.html
https://christianheilmann.com/2009/12/18/curl-your-view-source-of-the-web/

There are ways to navigate through the UI structure of a browser, but it isn't trivial, and is entirely dependent on what browser you're using.
https://stackoverflow.com/questions/57355191/get-active-tab-url-in-firefox-with-c

There might be better solution if you search for "C++ [browser] API"
Last edited on
getwindowtext can be powerful but it was really intended to be used for simple edit boxes, not an html widget. It may be that you can force it to work there, but you would likely get the html code, not the window text (data / what user reads).
Topic archived. No new replies allowed.