B4J Question [SOLVED] Size and position of windows.

jroriz

Active Member
Licensed User
Longtime User
Hi.

Based on this thread i was able to get the windows titles (all windows, not of my app).
Now i need to get size and position of this windows.

Any help?
 

xulihang

Active Member
Licensed User
Longtime User
but I did not know how to implement them.

Ye, it needs some knowledge of autoit. And the java lib does not have all the functions autoit provides.

Use the code below can get window's X position based on its title.

B4X:
Log(x.winGetPosX("Windows PowerShell",""))
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Based on the code from the link you posted:
B4X:
    For Each JO As JavaObject In L
        Log(JO.RunMethod("getTitle",Null))
       Dim awtrect As JavaObject = JO.RunMethod("getLocAndSize", Null)
       Log(awtrect)
       log(awtrect.GetField("x")) 'other fields: https://docs.oracle.com/javase/7/docs/api/java/awt/Rectangle.html
    Next
 
Upvote 0

jroriz

Active Member
Licensed User
Longtime User
Based on the code from the link you posted:
B4X:
    For Each JO As JavaObject In L
        Log(JO.RunMethod("getTitle",Null))
       Dim awtrect As JavaObject = JO.RunMethod("getLocAndSize", Null)
       Log(awtrect)
       log(awtrect.GetField("x")) 'other fields: https://docs.oracle.com/javase/7/docs/api/java/awt/Rectangle.html
    Next

Thats it!
 
Upvote 0
Top