You can hook notepad's textarea from visual basic via code below.
add one text1 ad write down code below.
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SendMessageS Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_GETTEXT = &HD
Dim TmpText As String * 256
Dim hwnd_Title As Long
Dim hwnd_Text As Long
Dim TextLen As Long
Private Sub Form_Load()
hwnd_Title = FindWindow("Notepad", "ag3nt.txt - Notepad")'Write title here
hwnd_Text = FindWindowEx(hwnd_Title, 0, "Edit", vbNullString) ' now after finding the program pid, get the edit box hwnd
TextLen = SendMessageS(hwnd_Text, WM_GETTEXT, Len(TmpText), TmpText) 'get the edit box containment
If TmpText = vbNullString Then
Text1.Text = "No text detected..."
Else:
Text1.Text = Left(TmpText, TextLen)
End If
End Sub
I hope it will be helpful for you all,ag3nt