Function:
GetTextExtentPoint32(HDC hdc, LPCTSTR lpString, int cbString, LPSIZE, lpSize)

Description:
Determines the width and height of a specified string of text using the currently selected font.

Parameters:
hdc: Identifies the device context.
lpString: Points to the string of text. The string does not need to be zero-terminated, since cbString specifies the length of the string.
cbString: Specifies the number of characters in the string.
lpSize: Points to a SIZE structure in which the dimensions of the string are to be returned.

Returns:
If the function succeeds, the return value is nonzero (the width of the specified text string). If the function fails, the return value is zero.

Example:
Click on the calc icon to view a sample of the GetTextExtentPoint32 function.