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:
  1. Private Const WM_GETTEXT As Integer = &HD
  2. 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
  3.     <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
  4. Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal lclassName As String, ByVal windowTitle As String) As IntPtr
  5.     End Function
  6. 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.)