tags:

views:

165

answers:

3

Background: I am looking to extract text data from the program Samsung PC Studio. What I need (SMS data) is stored in edit controls (text boxes). I would like to automate the process of extracting that data.

My first step was "GetWindowText" however MSDN itself clearly states that this does not support edit controls. It works with anything else like labels.

Does anyone know any API or other way (.NET is preferred) to get the data off an edit control in another application. Assuming I already have the handle of the control.

And yes, spy++ can see the data: i43.tinypic.com/2ykgt40.jpg

Any help would be greatly appreciated, as my inbox is always clogged with SMSes I need to archive.

A: 

In the normal Win32 API, Edit_GetText should work (it's a macro which does expand to GetWindowText underneath, though!), see http://msdn.microsoft.com/en-us/library/bb775458(VS.85).aspx and http://msdn.microsoft.com/en-us/library/bb849142(VS.85).aspx .

Alex Martelli
+1  A: 

Here's an article on how to do this using the MFC. Here's the essential code from that article:

CWnd* pWnd = GetOtherAppWindow();
TCHAR buf[512];
pWnd->SendMessage(WM_GETTEXT, sizeof(buf)/sizeof(TCHAR), (LPARAM)(void*)buf);
Naaff
A: 

The doco also says to retrieve the text of another application you can send a WM_GETTEXT. See: http://msdn.microsoft.com/en-us/library/ms633520(VS.85).aspx

Use SendMessage or PostMessage to do that:
http://msdn.microsoft.com/en-us/library/ms632627(VS.85).aspx

Scott Langham
jay