# IFont::get_hFont

Returns a Windows HFONT handle for the font described by this font object.

HRESULT get_hFont(

HFONT* phfont | //Pointer to the font handle
); |

Parameters

phfont
  [out] Pointer to the caller-allocated HFONT variable that receives the font handle. The caller does not own this resource and must not attempt to destroy the font.

Return Values

The method supports the standard return values E_UNEXPECTED and E_OUTOFMEMORY, as well as the following:

S_OK
  The font handle was retrieved successfully.
E_POINTER
  The address in phfont is not valid. For example, it may be NULL.

Remarks

#### Notes to Callers

The font object maintains ownership of the HFONT and can destroy it at any time without prior notification. If the caller needs to secure this font for a limited period of time, it can call IFont::AddRefHfont and IFont::ReleaseHfont.

See Also

IFont::AddRefHfont, IFont::ReleaseHfont