how to screen scrape from a windows text box

  • Thread starter Thread starter WFDGW2
  • Start date Start date
W

WFDGW2

I want to write or obtain C++ code that will scrape text from a dialog
box within a poker client, and then record that text somewhere else.

What do I do? Thanks.
 
Well, the first thing to do is post to the correct newsgroup. This is the C#
language group. For C++ code, you need the C++ group.

Aside from that, screen scraping is done pretty much the same way regardless
of whether from a windows app or a web app.
Peter
 
What do you mean by "scraping text"? Getting all dialog's child control's
captions?

Look at Win32 GetWindow() and GetWindowText() functions.

You'll need to call GetWindow(), starting with the parent dialog's HWND,
recursively. For each obtained child window's HWND, call GetWindowText().
That'll do it...

TCHAR tchWindowText[5000];

void SaveText( HWND hwndParent )
{
// Get the current window's caption.
GetWindowText( hwndParent, tchWindowText, 5000 ); // Save this text
wherever.

// Get all the child windows
HWND hwndChild;
while( ( hwndChild = GetWindow( hwndParent, GW_CHILD ) ) != NULL )
SaveText( hwndChild );

// Now process all siblings of this window.
HWND hwndSibling;
while( ( hwndSibling = GetWindow( hwndParent, GW_HWNDNEXT ) ) != NULL )
SaveText( hwndSibling );
}

// Call this with the dialog's HWND.
SaveText( hwndDialog );
 
Peter said:
Well, the first thing to do is post to the correct newsgroup. This is the C#
language group. For C++ code, you need the C++ group.

Good advice.
Aside from that, screen scraping is done pretty much the same way regardless
of whether from a windows app or a web app.

Web screen scraping consist of sending a HTTP request and pulling
the right information out of the returned HTML - often done using
regex.

I would expect screen scraping a win form to be very different.

Arne
 
Back
Top