I am trying to create a program in Java that is able to get positional information from unrelated windows in Windows. I need the rectangle from all the visible windows, I need to know which ones are minimized and also their Z-order. I read on a lot of questions here, learned a bit from JNA, but I still have some issues. (I gathered most of the information I know from here, even though I couldn't compile the code: Windows: how to get a list of all visible windows?)
The program shows a LOT of windows, even though they are not user-windows. I did not know Windows worked this way, so how can I filter what is a user window from all the other 'junk' windows?
The linked code from @mdma does not compile because Main.RECT must implement an abstract method from jna.Structure (getFieldOrder()). Is this an issue related to different versions of JNA? Am I doing something obviously wrong?
I am struggling to learn JNA in order to be able to create this program, but I never dealt with WinAPI and it is rather confusing. Thank you for your patience.
Edit: This is a short snippet of the code I couldn't compile. I am using the latest JNA (3.5.1).
import com.sun.jna.Structure;
public class Main {
public static void main(String[] args) {
public static class RECT extends Structure {
public int left,top,right,bottom;
}
}
}