'' Position ligne actuelle 'Dim lNumber, CPosition 'lNumber = txt.GetLineFromChar(txt.SelStart) + 1 'CPosition = txt.SelStart - Message(txt.hWnd, EM_LINEINDEX, 'txt.GetLineFromChar(txt.SelStart), vbNull) + 1 'AAA = lNumber '---------------------------------------- ' Nombre de ligne au total BBB = UBound(Split(TXT_FichierHosts, vbCrLf)) + 1 '---------------------------------------- 'Position caractère CCC = TXT_FichierHosts.SelStart '---------------------------------------- 'Nombre caractères au total DDD = "" '---------------------------------------- LBL_Rapport.Caption = AAA & "/" & BBB & " lignes | " & CCC & "/" & DDD & " mots"
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim ligne_a_lire As Long
ligne_a_lire = 3 ' pour lire la 3ème ligne, ici
MsgBox GetLine(Text1.hwnd, ligne_a_lire)
End Sub
Public Function GetLine(hwnd As Long, ligne_a_lire) As String
Dim tampon As String, x As Long
tampon = Space(200)
x = SendMessage(hwnd, &HC4, ligne_a_lire - 1, ByVal tampon)
GetLine = Left$(tampon, x)
End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim temp As String, ou As Long
temp = Text1.Text
Text1.Text = Left(Text1.Text, Text1.SelStart)
ou = SendMessage(Text1.hWnd, 186, 0, 0)
MsgBox ou
Text1.Text = temp
End Sub
Hummm... dis, pourquoi quand je veux remplacer le MsgBox par un label j'ai un message d'erreur :$
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim temp As String, ou As Long
temp = Text1.Text
Text1.Text = Left(Text1.Text, Text1.SelStart)
ou = SendMessage(Text1.hWnd, 186, 0, 0)
Label1.Caption = ou
Text1.Text = temp
End Sub