preNewItem method

void preNewItem(
  1. int dwFlags,
  2. IShellItem? psiDestinationFolder,
  3. PCWSTR pszNewName
)

Performs caller-implemented actions before the process to create a new item begins.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifileoperationprogresssink-prenewitem.

Implementation

@pragma('vm:prefer-inline')
void preNewItem(
  int dwFlags,
  IShellItem? psiDestinationFolder,
  PCWSTR pszNewName,
) {
  final hr$ = HRESULT(
    _PreNewItemFn(
      ptr,
      dwFlags,
      psiDestinationFolder?.ptr ?? nullptr,
      pszNewName,
    ),
  );
  if (hr$.isError) throw WindowsException(hr$);
}