B4J Question View in other app

Discussion in 'B4J Questions' started by GanjaKyp, May 7, 2019.

  1. GanjaKyp

    GanjaKyp Member Licensed User

    Is it possible to get text in other app label?
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is a low level accessibility API in Windows. However it is not something that you can access with B4J without quite a lot of complex work.
  3. MarkusR

    MarkusR Well-Known Member Licensed User

  4. MathiasM

    MathiasM Member Licensed User

    That would only work if the other application actually implemented sharing the text, isn't it?

    If you really want to scrape text of labels owned by other processes that you don't control (i.e, you didn't write) Than you have to do some WinApi stuff.
    Start here: https://stackoverflow.com/questions/352236/reading-from-a-text-field-in-another-applications-window for the right WinAPI commands, mainly you have to find the Handle of the other window via FindWindow, then get the Handle of the label., then use SendMessage with command 'WM_GETTEXT' to retrieve the text.
    Using WinAPI in Java should be easiest via JNA (https://github.com/java-native-access/jna), here is a tutorial: https://www.javaworld.com/article/2077828/open-source-java-projects-java-native-access.html

    This is not by any means a beginners task.

    If you control both applications, just use a socket.
    DonManfred likes this.
  5. MarkusR

    MarkusR Well-Known Member Licensed User

    me thought we want share data between his apps.

    in past it was possible to read text fields from other apps via win api, also password fields. but today i think its prevented my microsoft because misuse.
    Last edited: May 10, 2019
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice