[INCLUDE]
GetTextOutWidth

[CODE]
Public Function Ellipsis_TextEnd(ByVal hDC As Long, ByVal xText As String, ByVal MaxWidthPX As Long) As String
  Dim xLong1 As Long

  If GetTextOutWidth(hDC, xText) <= MaxWidthPX Then
    Ellipsis_TextEnd = xText
    Else
    xLong1 = Len(xText) - 1&
    Do Until (xLong1 < 0&)
      Ellipsis_TextEnd = Left(xText, xLong1) + "..."
      If GetTextOutWidth(hDC, Ellipsis_TextEnd) <= MaxWidthPX Then Exit Do
      xLong1 = xLong1 - 1&
      Loop
    End If
  End Function