Вот сам код функции:
- Код: Выделить всё
Public Function GetLine(hWnd As Long, Line As Long) As String
Dim sBuf As String, nLen As Long, nIndex As Long
nIndex = SendMessage(hWnd, EM_LINEINDEX, Line - 1, ByVal 0&)
If nIndex < 0 Or Line <= 0 Then Exit Function
nLen = SendMessage(hWnd, EM_LINELENGTH, nIndex, ByVal 0&)
sBuf = Space(nLen + 1)
Mid$(sBuf, 1, 1) = Chr$(nLen And &HFF)
Mid$(sBuf, 2, 1) = Chr$(nLen \ 256)
SendMessage hWnd, EM_GETLINE, Line - 1, ByVal sBuf
GetLine = Left$(sBuf, nLen)
End Function