|
-
Aug 4th, 2019, 08:55 AM
#1
Thread Starter
Hyperactive Member
Reading text from an open web browser tab
I am trying to read a chat window from a web browser tab that the user will already have open (for example, the user could have a Twitch stream open in the background, and the program would be scanning chat to do things like "notify the user when someone mentions their name").
In the past I have used the FindWindow API (for instance to get the handle of a notepad window) then using the FindWindowEx API to get the handle of the actual text box in notepad, then use the SendMessage API (using "WM_GETTEXT") to get the actual text.
vb Code:
Private Const WM_GETTEXT As Integer = &HD
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal lclassName As String, ByVal windowTitle As String) As IntPtr
End Function
Declare Auto Function FindWindow Lib "user32.dll" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
The FindWindow API works in this instance, but I don't know the class name of the "webpage viewing object" on the window of the web browser. Then I need to somehow extract the chat log. Any ideas? Thanks so much!
(I am testing things with the Brave web browser but am open to using any browser if we can get it working.)
-
Aug 4th, 2019, 10:07 AM
#2
Re: Reading text from an open web browser tab
You generally use a tool like Spy++, WinID or Winspector to determine things like window hierarchy and class names.
-
Aug 5th, 2019, 09:59 AM
#3
Thread Starter
Hyperactive Member
Re: Reading text from an open web browser tab
Thank you! I used those programs, and clearly this API method will not work. Does anyone have any other ideas?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|