ERRO AO CAPTURAR TEXTO
Galera seguinte fiz um programinha para capturar texto de outros programas tipo notepad, word e tal porem pro chat que quero capturar não ta funcionando, se alguem puder me ajudar! Vou postar o código aki do programa que funciona no bloco de notas e o outro que nao ta funcionando no chat. Se alguem puder dar um help agradeço!
Código do programa que captura do bloco de notas:
[ô]API Calls
Private Declare Function FindWindowA Lib [Ô]user32[Ô] (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowExA Lib [Ô]user32[Ô] (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowTextLengthA Lib [Ô]user32[Ô] (ByVal hWnd As Long) As Integer
Private Declare Function GetWindowTextA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Private Declare Function SendMessageA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Sub GetText()
Dim nTextLength As Long, szBuffer As String, lParent As Long, lChild As Long
lParent = FindWindowA([Ô]Notepad[Ô], [Ô]Sem tÃtulo - Bloco de notas[Ô])
lChild = FindWindowExA(lParent, 0, [Ô]Edit[Ô], [Ô][Ô])
nTextLength = SendMessageA(lChild, &HE, ByVal 0, ByVal 0) + 1
szBuffer = Space(nTextLength - 1)
SendMessageA lChild, &HD, ByVal nTextLength, ByVal szBuffer
Text1.Text = szBuffer
End Sub
Private Sub Timer1_Timer()
GetText
End Sub
Programa que captura do chat (não funcionando):
[ô]API Calls
Private Declare Function FindWindowA Lib [Ô]user32[Ô] (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowExA Lib [Ô]user32[Ô] (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowTextLengthA Lib [Ô]user32[Ô] (ByVal hWnd As Long) As Integer
Private Declare Function GetWindowTextA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Private Declare Function SendMessageA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Sub GetText()
Dim nTextLength As Long, szBuffer As String, lParent As Long, lChild(1 To 6) As Long
[ô]Get Parent Window
lParent = FindWindowA([Ô]TMainForm[Ô], [Ô]Profecy Chat[Ô])
[ô]Get Child Window(s)
lChild(1) = FindWindowExA(lParent, 0, [Ô]MDIClient[Ô], [Ô][Ô])
lChild(2) = FindWindowExA(lChild(1), 0, [Ô]TfrmChattChannel[Ô], [Ô]Profecy window chat[Ô])
lChild(3) = FindWindowExA(lChild(2), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(4) = FindWindowExA(lChild(3), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(5) = FindWindowExA(lChild(4), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(6) = FindWindowExA(lChild(5), 0, [Ô]TRichEdit98[Ô], [Ô][Ô])
nTextLength = SendMessageA(lChild(6), &HE, ByVal 0, ByVal 0) + 1
szBuffer = Space(nTextLength - 1)
SendMessageA lChild(6), &HD, ByVal nTextLength, ByVal szBuffer
Text1.Text = szBuffer
End Sub
Private Sub Timer1_Timer()
GetText
End Sub
Vlw. No aguardo!
Código do programa que captura do bloco de notas:
[ô]API Calls
Private Declare Function FindWindowA Lib [Ô]user32[Ô] (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowExA Lib [Ô]user32[Ô] (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowTextLengthA Lib [Ô]user32[Ô] (ByVal hWnd As Long) As Integer
Private Declare Function GetWindowTextA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Private Declare Function SendMessageA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Sub GetText()
Dim nTextLength As Long, szBuffer As String, lParent As Long, lChild As Long
lParent = FindWindowA([Ô]Notepad[Ô], [Ô]Sem tÃtulo - Bloco de notas[Ô])
lChild = FindWindowExA(lParent, 0, [Ô]Edit[Ô], [Ô][Ô])
nTextLength = SendMessageA(lChild, &HE, ByVal 0, ByVal 0) + 1
szBuffer = Space(nTextLength - 1)
SendMessageA lChild, &HD, ByVal nTextLength, ByVal szBuffer
Text1.Text = szBuffer
End Sub
Private Sub Timer1_Timer()
GetText
End Sub
Programa que captura do chat (não funcionando):
[ô]API Calls
Private Declare Function FindWindowA Lib [Ô]user32[Ô] (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowExA Lib [Ô]user32[Ô] (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowTextLengthA Lib [Ô]user32[Ô] (ByVal hWnd As Long) As Integer
Private Declare Function GetWindowTextA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Integer) As Integer
Private Declare Function SendMessageA Lib [Ô]user32[Ô] (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Sub GetText()
Dim nTextLength As Long, szBuffer As String, lParent As Long, lChild(1 To 6) As Long
[ô]Get Parent Window
lParent = FindWindowA([Ô]TMainForm[Ô], [Ô]Profecy Chat[Ô])
[ô]Get Child Window(s)
lChild(1) = FindWindowExA(lParent, 0, [Ô]MDIClient[Ô], [Ô][Ô])
lChild(2) = FindWindowExA(lChild(1), 0, [Ô]TfrmChattChannel[Ô], [Ô]Profecy window chat[Ô])
lChild(3) = FindWindowExA(lChild(2), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(4) = FindWindowExA(lChild(3), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(5) = FindWindowExA(lChild(4), 0, [Ô]TPanel[Ô], [Ô][Ô])
lChild(6) = FindWindowExA(lChild(5), 0, [Ô]TRichEdit98[Ô], [Ô][Ô])
nTextLength = SendMessageA(lChild(6), &HE, ByVal 0, ByVal 0) + 1
szBuffer = Space(nTextLength - 1)
SendMessageA lChild(6), &HD, ByVal nTextLength, ByVal szBuffer
Text1.Text = szBuffer
End Sub
Private Sub Timer1_Timer()
GetText
End Sub
Vlw. No aguardo!
verifica se a linha lParent = FindWindowA([Ô]TMainForm[Ô], [Ô]Profecy Chat[Ô]), está de acordo com o caption que aparece no programa.
Tópico encerrado , respostas não são mais permitidas