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.


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


[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
The provided interface identifier is invalid.
An unexpected error has occurred.
Insufficient memory for the operation.
One or more parameters are invalid.
The address in pFontDesc or ppvObj is not valid. Note that if pFontDesc is set to NULL, the function returns NO_ERROR.


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