IFont::SetHdc method (ocidl.h)
Provides a device context to the font that describes the logical mapping mode.
Syntax
HRESULT SetHdc(
[in] HDC hDC
);
Parameters
[in] hDC
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 code | Description |
---|---|
|
The font was selected successfully. |
|
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
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 |