IFont::get_hFont method (ocidl.h)

Retrieves a handle to the font described by this font object.

Syntax

HRESULT get_hFont(
  [out] HFONT *phFont
);

Parameters

[out] phFont

A pointer to the caller-allocated variable that receives the font handle. The caller does not own this resource and must not attempt to destroy the font.

Return value

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

Return code Description
S_OK
The font handle was retrieved successfully.
E_POINTER
The address in the phFont parameter 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.

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 ocidl.h

See also

IFont

IFont::AddRefHfont

IFont::ReleaseHfont