Help converting vb 2008 to vb6
Hi all .could any one help me convert the following code from vb 2008 to vb6 ? All it does reads text line from a chat room application. Looking forward for replies.Thanks
3 Code:
Declare Function SendMessageString Lib "USER32" _
Alias "SendMessageA" (ByVal hwnd As Integer, _
ByVal wMsg As Integer, ByVal wParam As Integer, _
ByVal lParam As StringBuilder) As Integer
Public Function GetLastLineTextChat(ByVal hwnd As Integer) As String
Dim iLastLine As Integer
Dim strBuffer As New StringBuilder(255)
'Get Line count
iLastLine = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0)
'get line text
Call SendMessageString(hwnd, EM_GETLINE, iLastLine - 2, strBuffer)
Return strBuffer.ToString
End Function
Private Sub Command1_Click()
Dim sChatText as String = GetLastLineTextChat(ReadTxtHnd)
End Sub
Re: Help converting vb 2008 to vb6
that should work in VB6. The one thing you will need to do is find the constants. Also, if you put this in a form you will need to change the line:
Declare Function SendMessage.....
to
Private Declare Function SendMessage.....
to find the constants I generarally google: VB6 Const EM_GETLINECOUNT =
and see what it returns. Most constants are declared in this format &H2 which is just hex for 2.