PDA

View Full Version : lenght of string in ortho mode



happy
04-02-2003, 10:28 AM
well i've found in MSDN a fonction called : GetCharABCWidthsFloat ; it seems to be better than GetCharWidth32 or GetCharWidthFloat, and here is its description:
BOOL GetCharABCWidthsFloat(
HDC hdc, // handle to DC
UINT iFirstChar, // first character in range
UINT iLastChar, // last character in range
LPABCFLOAT lpABCF // array of character widths
);

///////////////////////////////////////////
Parameters
hdc
[in] Handle to the device context.
iFirstChar
[in] Specifies the code point of the first character in the group of consecutive characters where the ABC widths are sought.
iLastChar
[in] Specifies the code point of the last character in the group of consecutive characters where the ABC widths are sought. This range is inclusive. An error is returned if the specified last character precedes the specified first character.
lpABCF
[out] Pointer to an array of ABCFLOAT structures that receives the character widths, in logical units.

Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
///////////////////////////////////////////

i call it like that :
int isOK=GetCharABCWidthsFloat(hDC,'a','z',lpABCF);

of course after having declared :
HDC hDC;
LPABCFLOAT lpABCF;

but the pb is that the value of isOK is always 0, ie the function fails, and i don't know why!!!

using GetLastError() i got error 87, ie according to MSDN System Error Codes : The parameter is incorrect (ERROR_INVALID_PARAMETER) !!!

please help i can't see where the error is

thanks

PS : if someone wants the MSDN page it's : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_3ook.asp