PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2012 Reading text from an open web browser tab-VBForums
Results 1 to 3 of 3

Thread: Reading text from an open web browser tab

  1. #1

    Thread Starter
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    278

    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:
    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.)

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,752

    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.

  3. #3

    Thread Starter
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    278

    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
  •  



Featured


Click Here to Expand Forum to Full Width