OleCreatePictureIndirect function (olectl.h)

Creates a new picture object initialized according to a PICTDESC structure.


WINOLECTLAPI OleCreatePictureIndirect(
  [in]  LPPICTDESC lpPictDesc,
  [in]  REFIID     riid,
  [in]  BOOL       fOwn,
  [out] LPVOID     *lplpvObj


[in] lpPictDesc

Pointer to a caller-allocated structure containing the initial state of the picture. The specified structure can be NULL to create an uninitialized object, in the event the picture needs to initialize via IPersistStream::Load.

[in] riid

Reference to the identifier of the interface describing the type of interface pointer to return in lplpvObj.

[in] fOwn

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.

[out] lplpvObj

Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, this parameter contains the requested interface pointer on the newly created 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 is set to NULL.

Return value

This function returns S_OK on success. Other possible values include the following.

Return code Description
The object does not support the interface specified in riid.
The address in pPictDesc or lplpvObj is not valid. For example, it may be NULL.


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.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header olectl.h
Library OleAut32.lib
DLL OleAut32.dll

See also