getString method

PWSTR getString(
  1. Pointer<PROPERTYKEY> key
)

Gets the string value of a specified property key.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellitem2-getstring.

Implementation

PWSTR getString(Pointer<PROPERTYKEY> key) {
  final ppsz = adaptiveCalloc<Pointer<Utf16>>();
  final hr$ = HRESULT(_GetStringFn(ptr, key, ppsz));
  if (hr$.isError) {
    free(ppsz);
    throw WindowsException(hr$);
  }
  final result$ = ppsz.value;
  free(ppsz);
  return .new(result$);
}