declare long GetTextExtentPoint32 in Win32API long hdc, ; string cString, long nSize, string @ cSize ... lnReturn = GetTextExtentPoint32(lnHDC, lcString, lnLen, @lcSize) ? long2num(LEFT(lcSize,4)) ? long2num(RIGHT(lcSize,4)) RETURN FUNCTION Long2Num(tcLong) DECLARE RtlMoveMemory IN WIN32API Long @Dest, ; String @Source, Long Length LOCAL lnNum lnNum = 0 = RtlMoveMemory(@lnNum, tcLong, 4) RETURN lnNum>Hi Everyone.
declare long GetTextExtentPoint32 in Win32API long hdc, ; > string @ cString, long nSize, string @ cSize >declare integer GetDC in Win32API integer hwnd >declare integer ReleaseDC in Win32API integer hwnd > >loForm = createobject('Form') >loForm.FontName = 'Arial' >loForm.FontSize = 10 >lnHWnd = loForm.HWnd >lnHDC = GetDC(lnHWnd) >lcSize = replicate(chr(0), 8) >lcString = '$99,999,999.99' >lnLen = len(lcString) >lnReturn = GetTextExtentPoint32(lnHDC, lcString, lnLen, lcSize) >* Get the text height and width from lcSize >ReleaseDC(lnHDC)However, while GetTextExtentPoint32 returns a successful value (1), lcSize doesn't contain the proper size (it's still 8 CHR(0)).