Public Function GetText1(ByVal hwnd As Long) As String
Dim l As Long, s As String, lc As Long, i As Long
GetText1 = ""
lc = SendMessageL(hwnd, EM_GETLINECOUNT, 0, 0) - 1
For i = 0 To lc
l = SendMessageL(hwnd, EM_LINEINDEX, i, 0)
l = SendMessageL(hwnd, EM_LINELENGTH, l, 0) + 1
s = String$(l + 2, 0)
Mid$(s, 1, 1) = Chr$(l And &HFF)
Mid$(s, 2, 1) = Chr$(l \ &H100)
l = SendMessageS(hwnd, EM_GETLINE, i, s)
GetText1 = GetText1 & Left$(s, l) & IIf(lc = 0 Or lc = i, "", vbCrLf)
Next
End Function
Public Function GetText2(ByVal hwnd As Long) As String
Dim l As Long, s As String
l = SendMessageL(hwnd, WM_GETTEXTLENGTH, 0, 0) + 1
s = String$(l, 0)
l = SendMessageS(hwnd, WM_GETTEXT, l, s)
GetText2 = Left$(s, l)
End Function
Public Function GetText3(ByVal hwnd As Long) As String
Dim l As Long, s As String
l = GetWindowTextLength(hwnd) + 1
s = String$(l, 0)
l = GetWindowText(hwnd, s, l)
GetText3 = Left$(s, l)
End Function
Public Declare Function SendMessageS Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function SendMessageL Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 6