GetThemePartSize function uxtheme

Pointer<SIZE> GetThemePartSize(
  1. HTHEME hTheme,
  2. HDC? hdc,
  3. int iPartId,
  4. int iStateId,
  5. Pointer<RECT>? prc,
  6. THEMESIZE eSize,
)

Calculates the original size of the part defined by a visual style.

Throws a WindowsException on failure.

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

Implementation

Pointer<SIZE> GetThemePartSize(
  HTHEME hTheme,
  HDC? hdc,
  int iPartId,
  int iStateId,
  Pointer<RECT>? prc,
  THEMESIZE eSize,
) {
  final psz = adaptiveCalloc<SIZE>();
  final hr$ = HRESULT(
    _GetThemePartSize(
      hTheme,
      hdc ?? nullptr,
      iPartId,
      iStateId,
      prc ?? nullptr,
      eSize,
      psz,
    ),
  );
  if (hr$.isError) {
    free(psz);
    throw WindowsException(hr$);
  }
  return psz;
}