Thread: Interface with external windows

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    3

    Interface with external windows

    Is there any way to capture data from or manipulate windows that don't belong to your application? For instance, if I want my program to click a button in another program, or read text from a text field in another program, is that possible?

    Thanks!

  2. #2
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    You could use FindWindowEx to find the window (though you'd have to know some specifics of which one you're looking for), and then follow up by using EnumChildWindows on the returned handle from FindWindow to go through all the child windows of that window or even use FindWindow again to find a specific child window, i.e. edit box.
    The only real problem is you'd need to know at least either the handle of the control or its ID within the parent window to get the right one.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Keep in mind that there are privacy issues associated with that.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    3
    Thanks @nthony, that'll definitely get me started.

    manutd, what privacy issues are there?

    Thanks!

  5. #5
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Well, for one this is the behavior a lot of illicit programs use. Second, you may capture private information that the user does not want you to have.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    3
    Ah, gotcha. I'm just trying to simplify a repetitive task for myself.

  7. #7
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Oh, that's fine. Just telling you to be aware. I had a friend who almost lost his job for something like that.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  2. calling an external program from within a windows GUI
    By korbitz in forum Game Programming
    Replies: 1
    Last Post: 03-16-2004, 10:39 PM
  3. Ask about these "unresolved external symbol" error
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2002, 11:39 AM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. Help with error
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 04-17-2002, 09:36 AM