GetCharWidth32A function (wingdi.h)
The GetCharWidth32 function retrieves the widths, in logical coordinates, of consecutive characters in a specified range from the current font.
BOOL GetCharWidth32A( [in] HDC hdc, [in] UINT iFirst, [in] UINT iLast, [out] LPINT lpBuffer );
A handle to the device context.
The first character in the group of consecutive characters.
The last character in the group of consecutive characters, which must not precede the specified first character.
A pointer to a buffer that receives the character widths, in logical coordinates.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
GetCharWidth32 cannot be used on TrueType fonts. To retrieve character widths for TrueType fonts, use GetCharABCWidths.
The range is inclusive; that is, the returned widths include the widths of the characters specified by the iFirstChar and iLastChar parameters.
If a character does not exist in the current font, it is assigned the width of the default character.
For an example, see "Displaying Keyboard Input" in Using Keyboard Input.
The wingdi.h header defines GetCharWidth32 as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||wingdi.h (include Windows.h)|