getting text from any text window.

This is a discussion on getting text from any text window. within the Windows Programming forums, part of the Platform Specific Boards category; hi guys, 1st sorry about my ad english. I'm not that expert at c++ programming (but i'm studying a lot). ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    2

    getting text from any text window.

    hi guys,
    1st sorry about my ad english.

    I'm not that expert at c++ programming (but i'm studying a lot). Ok, my question is:

    How can i get a text from any text window (a system like babylon translator...)?

    plus, how can i get information about of which app is that window?

    i hope u understood my poor english.

  2. #2
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    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

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    2
    thank u very much dude, ill test it.

    BTW, is there any way to store which application that window belongs?

  4. #4
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    i guess you could get the text from the main window and store that

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  3. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  4. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21