OleLoadPicture Function

Creates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect with NULL as the first parameter, followed by a call to IPersistStream::Load.

Syntax

C++
HRESULT OleLoadPicture(
  __in   LPSTREAM lpstream,
  __in   LONG lSize,
  __in   BOOL fRunmode,
  __in   REFIID riid,
  __out  LPVOID *lplpvObj
);

Parameters

lpstream [in]

Pointer to the stream that contains the picture's data.

lSize [in]

The number of bytes that should be read from the stream, or zero if the entire stream should be read.

fRunmode [in]

The opposite of the initial value of the KeepOriginalFormat property. If TRUE, KeepOriginalFormat is set to FALSE and vice-versa.

riid [in]

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

lplpvObj [out]

Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvObj contains the requested interface pointer on the storage of the object identified by the moniker. If *ppvObj is non-NULL, this function calls IUnknown::AddRef on the interface; it is the caller's responsibility to call IUnknown::Release. If an error occurs, *ppvObj is set to NULL.

Return Value

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

Return codeDescription
E_NOINTERFACE

The object does not support the specified interface.

E_POINTER

The stream is not valid. For example, it may be NULL.

 

Remarks

The stream must be in BMP (bitmap), WMF (metafile), or ICO (icon) format. A picture object created using OleLoadPicture always has ownership of its internal resources (fOwn==TRUE is implied).

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderOleCtl.h
LibraryOleAut32.lib
DLLOleAut32.dll

See Also

OleCreatePictureIndirect
PICTDESC

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Page view tracker