GetCharWidth

Syntax

BOOL GetCharWidth(hDC,wFirstChar,wLastChar,lpBuffer)

This function retrieves the widths of individual characters in a consecutive group of characters from the current font. For example, if the wFirstChar parameter identifies the letter a and the wLastChar parameter identifies the letter z, the GetCharWidth function retrieves the widths of all lowercase characters. The function stores the values in the buffer pointed to by the lpBuffer parameter.

Parameter Type/Description  

hDC HDC Identifies the device context.  
wFirstChar WORD Specifies the first character in a consecutive group of characters in the current font.  
wLastChar WORD Specifies the last character in a consecutive group of characters in the current font.  
lpBuffer LPINT Points to a buffer that will receive the width values for a consecutive group of characters in the current font.  

Return Value

The return value specifies the outcome of the function. It is nonzero if the function is successful. Otherwise, it is zero.

Comments

If a character in the consecutive group of characters does not exist in a particular font, it will be assigned the width value of the default character.