Share via


IPortableDeviceResources::CreateResource

banner art

Previous Next

IPortableDeviceResources::CreateResource

The CreateResource method creates a resource.

Syntax

  HRESULT CreateResource(
  IPortableDeviceValues*  pResourceAttributes
  IStream**  ppData,
  DWORD*  pdwOptimalWriteBufferSize,
  LPWSTR*  ppszCookie
);

Parameters

pResourceAttributes

[in]  Pointer to the following object parameter attributes.

Attribute Description
WPD_OBJECT_NAME The object name.
WPD_RESOURCE_ATTRIBUTE_TOTAL_SIZE The total size of the resource data stream.
WPD_RESOURCE_ATTRIBUTE_FORMAT The format of the resource data stream.
WPD_RESOURCE_ATTRIBUTE_RESOURCE_KEY The resource key.

ppData

[out]  Pointer to a stream into which the caller can write resource data.

pdwOptimalWriteBufferSize

[out]  Pointer to a value that specifies the optimal buffer size when writing to the stream. This parameter is optional.

ppszCookie

[out]  Pointer to a cookie that identifies the resource creation request. This parameter is optional.

Return Values

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
E_POINTER At least one of the arguments was a NULL pointer.

Remarks

When an application calls this method, it must specify the set of properties and it must write the required data to the stream that this method returns.

A resource is not created when the method returns; it is created when the application commits the data by calling the Commit method on the stream at which ppData points.

To cancel the data transfer to a resource, the application should call the Revert method on the stream at which ppData points.

Requirements

Header: Defined in PortableDeviceApi.h

Library: PortableDeviceGUIDs.lib

See Also

Previous Next