IFont::SetHdc method

Provides a device context to the font that describes the logical mapping mode.

Syntax


HRESULT SetHdc(
  [in] HDC hDC
);

Parameters

hDC [in]

A handle to the device context in which to select the font.

Return value

The method supports the standard return value E_INVALIDARG, as well as the following values.

Return codeDescription
S_OK

The font was selected successfully.

E_NOTIMPL

The font selection is not supported through this font object.

 

Remarks

The logical mapping mode affects the font's internal computation of its point size so that when the caller asks for a font handle by calling IFont::get_hFont, the font is already properly scaled to the device context.

Notes to Callers

The caller retains ownership of this device context which must remain valid for the lifetime of the font object. Thus, the device context passed should be a memory device context (from the function CreateCompatibleDC) and not a screen device context (from CreateDC, GetDC, or BeginPaint) because screen device contexts are a limited system resource.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

OCIdl.h

IDL

OCIdl.idl

IID

IID_IFont is defined as BEF6E002-A874-101A-8BBA-00AA00300CAB

See also

IFont

 

 

Show: