BOOL GetTextExtentPoint(hdc, lpsz, cbString, lpSize) | |||||
HDC hdc; | /* handle of device context | */ | |||
LPCTSTR lpsz; | /* address of text string | */ | |||
int cbString; | /* number of characters in string | */ | |||
LPSIZE lpSize; | /* address if structure for string size | */ |
The GetTextExtentPoint function computes the width and height of the line of text pointed to by the lpsz parameter. The GetTextExtentPoint function uses the currently selected font to compute the dimensions of the string. The width and height, in logical units, are computed without considering any clipping.
hdc
Identifies the device context.
lpsz
Points to a text string.
cbString
Specifies the number of characters in the text string.
lpSize
Points to a SIZE data structure. The dimensions of the string are returned here.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
The GetTextExtentPoint function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).
Since some devices do not place characters in regular cell arrays, that is they carry out kerning, the sum of the extents of the characters in a string may not be equal to the extent of the string.
The calculated width takes into account the intercharacter spacing set by SetTextCharacterExtra.
SetTextCharacterExtra