[API]
DrawTextADirect
DrawTextW
RECT

[INCLUDE]
LocalAllocFromString
PeekS

[CODE]
Public Function DrawTextMod(ByVal hdc As Long, ByRef lpStr As String, lpRect As RECT, ByVal wFormat As Long) As Long
  Dim xLong1 As Long
  Dim xLong2 As Long
  
  xLong1 = Len(lpStr)
  xLong2 = LocalAllocFromString(lpStr + String(3, vbNullChar))
'  Stop
  If Not xLong2 = 0& Then
    If IsUnicode Then
      DrawTextMod = DrawTextW(hdc, xLong2, xLong1, lpRect, wFormat)
      Else
      DrawTextMod = DrawTextADirect(hdc, xLong2, xLong1, lpRect, wFormat)
      End If
    If Not DrawTextMod = 0& Then
      lpStr = PeekS(xLong2)
      End If
    Call LocalFree(xLong2)
    End If
  End Function
