I've just added a lot of win32 related window functions into JNA. You can see the details here.
// Find and minimize a window:
WinDef.HWND hWnd = User32.INSTANCE.FindWindow("className", "windowName");
User32.INSTANCE.ShowWindow(hWnd, WinUser.SW_MINIMIZE);
You can also enumerate all windows:
final WinDef.HWND[] windowHandle = new WinDef.HWND[1];
User32.INSTANCE.EnumWindows(new WinUser.WNDENUMPROC() {
@Override
public boolean callback(WinDef.HWND hwnd, Pointer pointer) {
if (matches(hwnd)) {
windowHandle[0] = hwnd;
return false;
}
return true;
}
}, Pointer.NULL);
// Minimize or maximize windowHandle[0] here...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…