accessing text from another program

This is a discussion on accessing text from another program within the Windows Programming forums, part of the Platform Specific Boards category; Anyone know how I can make a program that can read text from another program's window? I'm making the program ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    5

    accessing text from another program

    Anyone know how I can make a program that can read text from another program's window?

    I'm making the program that needs to read the text, but I didn't make the program it needs to read from and I don't have access to its source code.

    Is there some Windows API for doing things like this?

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Here's a program I just whipped together that might help you a bit.

    Code:
     #include <iostream.h>
     #include <windows.h>
     
     int main()
     {
     	while(1)
     	{
     		POINT mouse;
     		GetCursorPos(&mouse);
     		HWND hwnd=WindowFromPoint(mouse);
     		char text[512];
     		GetWindowText(hwnd,text,511);
     		cout << text << endl;
     		Sleep(1000);
     	}
     	return 0;
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. accessing memory used by another program
    By MK27 in forum C Programming
    Replies: 25
    Last Post: 09-17-2008, 11:22 AM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Replies: 3
    Last Post: 05-25-2005, 02:50 PM
  4. Replies: 8
    Last Post: 03-31-2003, 03:01 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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