Thread: accessing text from another 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
    New York
    Posts
    1,905
    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, 10: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, 01: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, 10:04 PM