# OleCreatePictureIndirect

Creates a new picture object initialized according to a PICTDESC structure, which can be NULL to create an uninitialized object if the caller wishes to have the picture initialize itself through IPersistStream::Load. The fOwn parameter indicates whether the picture is to own the GDI picture handle for the picture it contains, so that the picture object will destroy its picture when the object itself is destroyed. The function returns an interface pointer to the new picture object specified by the caller in the riid parameter. A QueryInterface is built into this call. The caller is responsible for calling Release through the interface pointer returned.

STDAPI OleCreatePictureIndirect(

PICTDESC* pPictDesc, | //Pointer to the structure of parameters for picture
REFIID riid, | //Reference to the identifier of the interface
BOOL fOwn, | //Whether the picture is to be destroyed
VOID** ppvObj | //Indirect pointer to the initial interface pointer on the new object
); |

Parameters

pPictDesc
  [in] Pointer to a caller-allocated structure containing the initial state of the picture.
riid
  [in] Reference to the identifier of the interface describing the type of interface pointer to return in ppvObj.
fOwn
  [in] If TRUE, the picture object is to destroy its picture when the object is destroyed. If FALSE, the caller is responsible for destroying the picture.
ppvObj
  [out] Indirect pointer to the initial interface pointer on the new object. If the call is successful, the caller is responsible for calling Release through this interface pointer when the new object is no longer needed. If the call fails, the value of ppvObj is set to NULL.

Return Values

This function supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:

S_OK
  The new picture object was created successfully.
E_NOINTERFACE
  The object does not support the interface specified in riid.
E_POINTER
  The address in pPictDesc or ppvObj is not valid. For example, it may be NULL.

See Also

OleLoadPicture, PICTDESC