The GetTabbedTextExtent function computes the width and height of a character string. If the string contains one or more tab characters, the width of the string is based upon the specified tab stops. The GetTabbedTextExtent function uses the currently selected font to compute the dimensions of the string.
DWORD GetTabbedTextExtent(
HDC hDC, // handle to device context
LPCTSTR lpString, // pointer to character string
int nCount, // number of characters in string
int nTabPositions, // number of tab positions
LPINT lpnTabStopPositions // pointer to array of tab positions
);
If the function succeeds, the return value is the dimensions of the string. The height is in the high-order word and the width is in the low-order word.
If the function fails, the return value is 0. GetTabbedTextExtent will fail if hDC is invalid and if nTabPositions is less than 0.
Windows NT: To get extended error information, call GetLastError.
The current clipping region does not affect the width and height returned by the GetTabbedTextExtent function.
Because some devices do not place characters in regular cell arrays (that is, they kern the characters), the sum of the extents of the characters in a string may not be equal to the extent of the string.
If the nTabPositions parameter is zero and the lpnTabStopPositions parameter is NULL, tabs are expanded to eight times the average character width.
If nTabPositions is 1, the tab stops are separated by the distance specified by the first value in the array to which lpnTabStopPositions points.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Fonts and Text Overview, Font and Text Functions, GetTextExtentPoint32, HIWORD, LOWORD, TabbedTextOut