Here is the snapshot what I want exately!
I am trying to develop a pr
Here is the solution to get titles of ALL (visible, non-visible) windows: https://stackoverflow.com/a/11067492/6401177
If you want to get titles of opened top-level windows only (i.e. Applications taskbar), you have to check the visibility of each window (and/or check other conditions as listed here: http://vb.mvps.org/articles/ap200003.asp). Although, checking window's visibility seems sufficient.
I just altered method "callback" in previous code like this:
String wText = Native.toString(windowText, System.getProperty("file.encoding")).trim();
com.sun.jna.platform.win32.WinDef.HWND hwnd_1 = new WinDef.HWND(hWnd);
boolean b = com.sun.jna.platform.win32.User32.INSTANCE.IsWindowVisible(hwnd_1);
if (!wText.isEmpty() && b) {
windowNames.add(wText);
}
I also added "file.encoding" so titles are shown correctly in non-english Windows environment too. I tested code in Windows XP/7/8 and it works nice. The only problem seems to be that some default internal(?) window called "Program Manager" is always included in the list.
You need both JARs (JNA libraries) from: https://github.com/java-native-access/jna