boolean (int value) { try { if (User32Ex.INSTANCE.SystemParametersInfo(new WinDef.UINT(0x2001 /* SPI_SETFOREGROUNDLOCKTIMEOUT */), new WinDef.UINT(), new WinDef.UINT(value), new WinDef.UINT())) { LOG.info("Foreground lock timeout set to " + value); return true; } else { LOG.debug("Failed to set foreground lock timeout to " + value + ", will retry on next window activation"); return false; } } catch (Exception e) { LOG.warn("Error setting foreground lock timeout using SystemParametersInfo", e); } return true; // do not retry on exception }