public static boolean isAeroEnabled(){ if( HearthHelper.getOSName().equals("win") && DWM == null){ try{ DWM = NativeLibrary.getInstance("dwmapi"); } catch(Throwable e) {} } boolean dwmEnabled = false; if(DWM != null){ boolean[] bool = { false }; Object[] args = { bool }; Function DwmIsCompositionEnabled = DWM.getFunction("DwmIsCompositionEnabled"); HRESULT result = (HRESULT) DwmIsCompositionEnabled.invoke(HRESULT.class, args); boolean success = result.intValue()==0; if(success && bool[0]){ dwmEnabled = true; } } return dwmEnabled; }
/** * Succeeded. * * @param hr the hr * @return true, if successful */ public static final boolean SUCCEEDED(HRESULT hr) { if (hr != null) { return SUCCEEDED(hr.intValue()); } else { return false; } }
/** * Failed. * * @param hr the hr * @return true, if successful */ public static final boolean FAILED(HRESULT hr) { if (hr != null) { return FAILED(hr.intValue()); } else { return false; } }
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()); }
/** * Returns the error code of the error. * * @return Error code. */ public HRESULT getHR() { return _hr; }
/** * New Win32 exception from HRESULT. * * @param hr HRESULT */ public Win32Exception(HRESULT hr) { //super(Kernel32Util.formatMessageFromHR(hr)); _hr = hr; }
/** * Map a WIN32 error value into a HRESULT Note: This assumes that WIN32 * errors fall in the range -32k to=32k. * * @param x original w32 error code * @return the converted value */ public static final HRESULT HRESULT_FROM_WIN32(int x) { int f = FACILITY_WIN32; return new HRESULT(x <= 0 ? x : ((x) & 0x0000FFFF) | (f <<= 16) | 0x80000000); }
public HRESULT SetWindowTheme(HWND hwnd, WString pszSubAppName, WString pszSubIdList);
public HRESULT DwmExtendFrameIntoClientArea(HWND window, MARGINS margins);
public HRESULT DwmRegisterThumbnail(HWND hwndDestination, HWND hwndSource, IntByReference phThumbnailId);
public HRESULT DwmUnregisterThumbnail(INT_PTR hThumbnailId);
public HRESULT DwmQueryThumbnailSourceSize(INT_PTR hThumbnail, SIZE size);
public HRESULT DwmUpdateThumbnailProperties(INT_PTR hThumbnailId, DWM_THUMBNAIL_PROPERTIES ptnProperties);
public HRESULT DwmGetColorizationColor(DWORDByReference color, BOOLByReference pfOpaqueBlend);
public HRESULT SetWindowCompositionAttribute(HWND hwnd, WindowCompositionAttributeData data);
public HRESULT GetWindowCompositionAttribute(HWND hwnd, WindowCompositionAttributeData task);
HRESULT SetProgressStateA(HWND h, int i);