GetThemeMetric function uxtheme

int GetThemeMetric(
  1. HTHEME hTheme,
  2. HDC? hdc,
  3. int iPartId,
  4. int iStateId,
  5. THEME_PROPERTY_SYMBOL_ID iPropId,
)

Retrieves the value of a metric property.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/uxtheme/nf-uxtheme-getthememetric.

Implementation

int GetThemeMetric(
  HTHEME hTheme,
  HDC? hdc,
  int iPartId,
  int iStateId,
  THEME_PROPERTY_SYMBOL_ID iPropId,
) {
  final piVal = adaptiveCalloc<Int32>();
  final hr$ = HRESULT(
    _GetThemeMetric(hTheme, hdc ?? nullptr, iPartId, iStateId, iPropId, piVal),
  );
  if (hr$.isError) {
    free(piVal);
    throw WindowsException(hr$);
  }
  final result$ = piVal.value;
  free(piVal);
  return result$;
}