Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6903809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:58:18+00:00 2026-05-27T07:58:18+00:00

Is it possible to scrape the text from a textbox that is contained within

  • 0

Is it possible to scrape the text from a textbox that is contained within a separate executable? I have an application that has a debug window. The debug window generates a verbose log. However, the log never is saved anywhere and can only be viewed within the app. If the app generates an exception, I’d like to email myself knowing that an exception has been generated so I can hop in and check things out. There is also a button to copy the textbox so I was thinking of using Spy++ to get the command information. However, I don’t know where to go from there. Any pointers are greatly appreciated.

I’d prefer to use C# in .NET, but if I need to use C++, I will.

UPDATE:

Based on the comments, I’ve tried doing the following:

Private Declare Function GETWINDOWTEXT Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Integer) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindow As String) As IntPtr
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Private Const WM_GETTEXT As Short = &HDS
Private Const WM_GETTEXTLENGTH As Short = &HES

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim hwnd As Integer = FindWindowEx(0, 0, "MyAppForm", "Hello World")

    If Not hwnd = 0 Then
        SetForegroundWindow(hwnd)

        'Dim LabelEx As Integer = FindWindowEx()
        Dim TextBoxEx As Integer = FindWindowEx(hwnd, 0, "MyAppTextBox", vbNullString)
        Dim txtLength As Long = SendMessage(TextBoxEx, WM_GETTEXTLENGTH, CInt(0), CInt(0)) + 1
        Dim txtBuff As String = Space(txtLength)
        Dim txtValue As Long = SendMessage(TextBoxEx, WM_GETTEXT, txtLength, txtBuff)

        MsgBox(txtBuff)
    End If
End Sub

However, I can’t seem to find the handle of the textbox control. When I enumerate all of the windows, I only see one TextBox object, but I see the parent multiple times throughout the enumeration. How can I get the pointers to the controls within the window?

UPDATE 2:

I’ve uploaded a sample Windows app to show the type of app I’m trying to get access to. I’m trying to get the values of both labels in addition to the textbox. The textbox is the most important. The sample Win app is here: http://www.mediafire.com/file/172r2xapj7p4f2f/StatusSimulator.zip

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:58:19+00:00Added an answer on May 27, 2026 at 7:58 am

    Text scraping is done by accessibility interfaces. For managed code, you can use the classes in the System.Windows.Automation namespace. If you already have a window handle, then extracting the text is simple:

    AutomationElement.FromHandle(hwnd)
                     .GetCurrentPropertyValue(ValuePattern.ValueProperty) as string;
    

    (Kind of confused since the question is tagged C# and you ask for a C# solution, but your code sample is in VB.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to scrape all the text from a site that was navigated
I have an application that deals with clients from all over the world, and,
I have a C# app that needs to scrape many many pages within a
I have an application which scrapes soccer results from different sources on the web.
I'd like to execute JavaScript code from within a C# assembly and have the
What's the easiest way to scrape just the text from a handful of webpages
I have a script that I wrote in PHP which scrapes data from a
I've written a Scrapy spider that extracts text from a page. The spider parses
The HTML you see below is text I have scraped from a remote site,
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.