cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Active window text
Active window text
Aug 29, 2020 at 11:28am
Aug 29, 2020 at 11:28am UTC
surgeon22
(1)
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
Aug 29, 2020 at 12:58pm
Aug 29, 2020 at 12:58pm UTC
Ganado
(6825)
"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
Aug 29, 2020 at 12:59pm
Aug 29, 2020 at 12:59pm UTC
Aug 29, 2020 at 3:06pm
Aug 29, 2020 at 3:06pm UTC
jonnin
(11489)
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.