OleLoadPictureEx function (olectl.h)

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

WINOLECTLAPI OleLoadPictureEx(
  [in]  LPSTREAM lpstream,
  [in]  LONG     lSize,
  [in]  BOOL     fRunmode,
  [in]  REFIID   riid,
  [in]  DWORD    xSizeDesired,
  [in]  DWORD    ySizeDesired,
  [in]  DWORD    dwFlags,
  [out] LPVOID   *lplpvObj
);

Parameters

[in] lpstream

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

[in] lSize

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

[in] fRunmode

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

[in] riid

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

[in] xSizeDesired

Desired width of icon or cursor. Valid values are 16, 32, and 48. Pass LP_DEFAULT to both size parameters to use system default size.

[in] ySizeDesired

Desired height of icon or cursor. Valid values are 16, 32, and 48. Pass LP_DEFAULT to both size parameters to use system default size.

[in] dwFlags

Desired color depth for icon or cursor. Values are LP_MONOCHROME (monochrome), LP_VGACOLOR (16 colors), LP_COLOR (256 colors), or LP_DEFAULT (selects best depth for current display).

[out] lplpvObj

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 code Description
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.

Remarks

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

In addition to allowing specification of icon or cursor size, OleLoadPictureEx supports loading of color cursors.

Requirements

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

OleCreatePictureIndirect

PICTDESC