Announcement

Collapse
No announcement yet.

capture text from another application

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • capture text from another application

    I'm looking for a way to capture text from another application. I thought that by having a "hot spot" onto which the other app's text window could be dragged, that I could detect it using childwindowfrompoint and send it a WM_GETTEXT message just to see what happens.

    Problems:
    1. the only hWND returned is that of the dialog which owns the control containing the hot spot.
    2. this means that my app must lurk in a loop waiting for the other app to "arrive", but I do not want to dedicate my app to this task. So, should I use a second thread, or is there some way I can get notified when the other app arrives? At present, no messages appear in my app when the other app is moved accross it.


    Is there another way of doing this?

  • #2
    OK will abandon this idea & settle for drag and drop ... for now ...

    Comment


    • #3
      AutoIt

      AutoIt can do that.

      Comment


      • #4
        Chris,

        Have you considered using EnumWindows and EnumChildWindows API functions ?

        If you know the classes of the window and control that you want to grab the text from, you should be able to find the control using above functions and get the text.

        Plenty of sample code on these forums but this might be a start:
        http://www.powerbasic.com/support/fo...ML/010865.html

        Kind regards
        Eddy

        Comment


        • #5
          I am still trying to get text from a console program without having to run a tsr in the console and having to run the console application by shelling my program.

          I have tried some of the examples of getting text in other programs using the dialogs handle and control id, and that seems to be working.

          So does a console program have a control id for its display, or is there a way to pass the displays memory location.

          If so i could write a console program that is ran from a batch file and gathers information on the console displayed handle then pass some parameters to either a text file that another program would read,
          or pass the parameters to another program by command line in the batch file to another program that will run asynchronous and that asynchronous program would monitor the consoles display.

          i want to gather information from another programs display.

          basically i want to run another program that gathers account information and it finds the account number from the monitoring another programs display.
          Last edited by Paul Purvis; 14 Mar 2008, 05:34 PM.
          p purvis

          Comment


          • #6
            Originally posted by paul d purvis View Post
            So does a console program have a control id for its display...
            Paul, if you download and run the "Windows Treeview" code from post #25 in this thread you will be able to see the window for the console (assuming you have one open!). It's class is ConsoleWindowClass and its id is whatever title you have given to the console window - the default is "Command Prompt" if you open it from the desktop, I don't know about starting it programmatically but I expect it will have the same class.

            Comment


            • #7
              Thanks Chris

              nice program

              that program helped me learn

              what i was trying to do was see the characters in the console window

              a few years back i wrote a tsr that would read the screen for certain information if nothing was typed in a certain amount of time, then do something depending on what was on the screen.

              i may have to do the same thing, but i would just have the program send the screen to the a file and let some other program read the file.

              i just was not happy about the tsr size in memory being what it was and i di did not want the program to look for time of no activity by the keyboard.
              not to mention cpu usage in windows.

              paul
              p purvis

              Comment


              • #8
                Paul, this is pure theory (I mean I haven't done it) but how about ReadConsoleOutput? You will have to open the console with Createfile.

                Comment


                • #9
                  thanks Chris for responding.

                  that does work.

                  but it requires the console program that i want the screen's characters from to run under the control of a program i would have to start first, and i do not want to do that, because the console program i want the screen characters from is written by a third party and that party is responsible for the program running correctly in production.

                  i think i had hear somewhere on this forum that in vista, vista really puts a stop on reading characters from other programs, unless those programs allow it. i may have very much misunderstood on this vista information.

                  i have been reading at the website of microsoft on console programming, but i have not seen anything that allows this. Matter of fact the information i did read was that console programs are not like the normal windows programs and when it came time to create those parts for the os, i believe they pushed the project on the subject of console related programs and just did what they could to get console programs running.


                  paul
                  Last edited by Paul Purvis; 16 Mar 2008, 03:43 AM.
                  p purvis

                  Comment


                  • #10
                    Originally posted by paul d purvis View Post
                    i have been reading at the website of microsoft on console programming
                    Ah, you are [email protected] another application! sorry, I missed that part. I tried something like this a couple of years ago and got nowhere with it, ended up writing a clone of the original application.
                    Last edited by Chris Holbrook; 16 Mar 2008, 04:22 PM. Reason: changed spelling of a word which Paul found offensive

                    Comment

                    Working...
                    X