B4J Question All windows Titles

jroriz

Active Member
Licensed User
Longtime User
Hi.

Is it possible to get all windows titles. All, not only from my application.
 

stevel05

Expert
Licensed User
Longtime User
You can get them using JNA. Jar downloads are here https://github.com/java-native-access/jna, you need both the JNA and the JNA Platform jars. Scroll down to the downloads section

Javadoc is here: http://java-native-access.github.io/jna/5.0.0/javadoc/

Copy both of the jars to your additional libraries folder, include them in your project:

B4X:
#AdditionalJar: jna-5.0.0
#AdditionalJar: jna-platform-5.0.0

And run the code :

B4X:
    Dim WU As JavaObject
    WU.InitializeStatic("com.sun.jna.platform.WindowUtils")
    Dim L As List = WU.RunMethod("getAllWindows",Array(True)) ' or False if you want to include windows that are not visible
 
    For Each JO As JavaObject In L
        Log(JO.RunMethod("getTitle",Null))
    Next
 
Last edited:
Upvote 0

jroriz

Active Member
Licensed User
Longtime User
You can get them using JNA. Jar downloads are here https://github.com/java-native-access/jna, you need both the JNA and the JNA Platform jars. Scroll down to the downloads section

Javadoc is here: http://java-native-access.github.io/jna/5.0.0/javadoc/

Copy both of the jars to you additional libraries folder, include them in your project:

B4X:
#AdditionalJar: jna-5.0.0
#AdditionalJar: jna-platform-5.0.0

And run the code :

B4X:
    Dim WU As JavaObject
    WU.InitializeStatic("com.sun.jna.platform.WindowUtils")
    Dim L As List = WU.RunMethod("getAllWindows",Array(True)) ' or False if you want to include windows that are not visible
 
    For Each JO As JavaObject In L
        Log(JO.RunMethod("getTitle",Null))
    Next

Like a charm...
Thanks.
 
Upvote 0
Top