get last line

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #15234
    imFiles
    Administrator

    i have this function to get the last line from pal room..it work fine under compile target net framework 3.5 . but when i compile the app for target framework 4
    some times it return value as text and other times it dosn’t return text at all…any explnation or how to make it work for net framework 4

     

    Private Function GetLastLineTextChat(ByVal hwnd As IntPtr, ByRef iLastLine As Integer) As String()
    Dim lngCount As Integer
    Dim lngLength As Integer
    Dim strBuffer As New StringBuilder(255)
    Dim sText() As String = Nothing
    'Get Line count
    lngCount = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0)
    lngLength = SendMessage(hwnd, EM_LINELENGTH, lngCount - 2, 0)
    
    'get line text
    If iLastLine = 0 Then iLastLine = lngCount
    If lngCount > iLastLine Then
    Do While iLastLine <= lngCount
    iLastLine = iLastLine + 1
    If sText Is Nothing Then
    ReDim sText(0)
    Else
    Dim iCount As Integer = sText.Length
    ReDim Preserve sText(iCount)
    End If
    
    'get line text
    Call SendMessageString(hwnd, EM_GETLINE, iLastLine - 2, strBuffer)
    sText(sText.Length - 1) = strBuffer.ToString
    If iLastLine = lngCount Then
    Exit Do
    End If
    Loop
    ElseIf iLastLine <> lngCount Then
    iLastLine = lngCount
    ReDim sText(0)
    'get line text
    Call SendMessageString(hwnd, EM_GETLINE, iLastLine - 2, strBuffer)
    sText(sText.Length - 1) = strBuffer.ToString
    ElseIf iLastLine = lngCount Then
    End If
    Return sText
    End Function

     

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.