void (String dir, @Nullable String toSelect) { if (LOG.isDebugEnabled()) LOG.debug("shell open: dir=" + dir + " toSelect=" + toSelect); ProcessIOExecutorService.INSTANCE.execute(() -> { Ole32.INSTANCE.CoInitializeEx(null, Ole32.COINIT_APARTMENTTHREADED); var pIdl = Shell32Ex.INSTANCE.ILCreateFromPath(dir); var apIdl = toSelect != null ? new Pointer[]{Shell32Ex.INSTANCE.ILCreateFromPath(toSelect)} : null; var cIdl = new WinDef.UINT(apIdl != null ? apIdl.length : 0); try { var result = Shell32Ex.INSTANCE.SHOpenFolderAndSelectItems(pIdl, cIdl, apIdl, new WinDef.DWORD(0)); if (!WinError.S_OK.equals(result)) { LOG.warn("SHOpenFolderAndSelectItems(" + dir + ',' + toSelect + "): 0x" + Integer.toHexString(result.intValue())); openViaExplorerCall(dir, toSelect); } } finally { if (apIdl != null) { Shell32Ex.INSTANCE.ILFree(apIdl[0]); } Shell32Ex.INSTANCE.ILFree(pIdl); } }); }