OleLoadPicturePath function (olectl.h)

Creates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followed by IPersistStream::Load.

Syntax

WINOLECTLAPI OleLoadPicturePath(
  [in]  LPOLESTR  szURLorPath,
  [in]  LPUNKNOWN punkCaller,
  [in]  DWORD     dwReserved,
  [in]  OLE_COLOR clrReserved,
  [in]  REFIID    riid,
  [out] LPVOID    *ppvRet
);

Parameters

[in] szURLorPath

The path or URL to the file you want to open.

[in] punkCaller

Points to IUnknown for COM aggregation.

[in] dwReserved

Reserved.

[in] clrReserved

The color you want to reserve to be transparent.

[in] riid

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

[out] ppvRet

Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvRet contains the requested interface pointer on the storage of the object identified by the moniker. If *ppvRet 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, *ppvRet is set to NULL.

Return value

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

Return code Description
S_OK
The dialog box was created successfully.
E_FAIL
Unable to load picture stream.
E_POINTER
The address in ppvRet is NULL.
E_NOINTERFACE
The object does not support the interface specified in riid.

Remarks

The stream must be in BMP (bitmap), JPEG, WMF (metafile), ICO (icon), or GIF format.

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

OleLoadPicture