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) !!!
of course after having declared :
LPABCFLOAT lpABCF;
The problem is that you have to declare either ABCFLOAT theABCF (or as an array) and pass it as &theABCF (array does not need the address of) or initialize your lpABCF variable since it is a pointer pointing to some arbitrary and unknown address in memory using malloc or new.
[This message has been edited by shinpaughp (edited 04-02-2003).]