if its in api you can use either findwindow or windowfrompoint to find the window.
then use gettext to get the text.
small example
Code:
hwnd hwnd , hwndButton1 , hwndButton2 , hwndHook;
.......
case WM_COMMAND:
if((HWND)lParam == hwndButton1){
POINT pt;
MessageBox(0 , "Move the OK button of the window and press ok" , "test" , 0);
GetCursorPos(&pt);
hwndHook = WindowFromPoint(pt);
}
if((HWND)lParam == Button2){
char a[128];
SendMessage(hwndHook , WM_GETTEXT , (WPARAM)sizeof(a) , (LPARAM)a);
MessageBox(0 , a , "test" , 0);
}
......
thats for getting text from a window thats not in your program.if its in the program just use WM_GETTEXT to the window
hope that helps