OleCreateFontIndirect function (olectl.h)

Creates and initializes a standard font object using an initial description of the font's properties in a FONTDESC structure. The function returns an interface pointer to the new font object specified by caller in the riid parameter. A QueryInterface call is part of this call. The caller is responsible for calling Release through the interface pointer returned.

Syntax

WINOLECTLAPI OleCreateFontIndirect(
  [in]  LPFONTDESC lpFontDesc,
  [in]  REFIID     riid,
  [out] LPVOID     *lplpvObj
);

Parameters

[in] lpFontDesc

Address of a caller-allocated, FONTDESC structure containing the initial state of the font. This value must not be NULL.

[in] riid

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

[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 font object. If successful, the caller is responsible to call Release through this interface pointer when the new object is no longer needed. If unsuccessful, the value of 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 provided interface identifier is invalid.
E_UNEXPECTED
An unexpected error has occurred.
E_OUTOFMEMORY
Insufficient memory for the operation.
E_INVALIDARG
One or more parameters are invalid.
E_POINTER
The address in pFontDesc or ppvObj is not valid. Note that if pFontDesc is set to NULL, the function returns NO_ERROR.

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

FONTDESC