public String resolveFolder(FolderId folderId) { int folder = convertFolderId(folderId); char[] pszPath = new char[WinDef.MAX_PATH]; HRESULT result = Shell32.INSTANCE.SHGetFolderPath(null, folder, null, null, pszPath); if (W32Errors.S_OK.equals(result)) { return Native.toString(pszPath); } logger.error("SHGetFolderPath returns an error: {}", result.intValue()); throw new AppDirsException( "SHGetFolderPath returns an error: " + result.intValue()); }
/** * @return 0 - color in format 0xAARRGGBB, 1 - opaque */ public static int[] DwmGetColorizationColor() { IntByReference colorRef = new IntByReference(); IntByReference opaqueRef = new IntByReference(); WinNT.HRESULT hresult = DwmApi.INSTANCE.DwmGetColorizationColor(colorRef, opaqueRef); if(W32Errors.S_OK.equals(hresult)) { return new int[] {colorRef.getValue(), opaqueRef.getValue()}; } return new int[2]; }
public static boolean DwmIsCompositionEnabled() { IntByReference reference = new IntByReference(); WinNT.HRESULT hresult = INSTANCE.DwmIsCompositionEnabled(reference); return W32Errors.S_OK.equals(hresult) && reference.getValue() == 1; }