Ok i hope i did this right, here is what i have, atleast it builds, but when i hit the button it dosent do anything":

VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  4. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  5. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Long
  6.  
  7.     Public Sub proc()
  8.         Dim hwnd As Long
  9.         Dim hwndEx As Long
  10.  
  11.         'gets handle of notepad
  12.         hwnd = FindWindow("Notepad", vbNullString)
  13.  
  14.         'gets handle of 'edit' area of notepad
  15.         hwndEx = FindWindowEx(hwnd, vbNullString, "edit", vbNullString)
  16.         Dim x As Integer
  17.         x = 1
  18.         Dim buffer As String    'buffer will contain the text from notepad
  19.         buffer = "                                                       "
  20.        
  21.         'sends WM_GETTEXT message to 'edit' area of notepad
  22.         Dim x As Integer
  23.         x = SendMessage(hwndEx, 13, buffer)
  24.         buffer = buffer.Substring(0, x)
  25.         Text1.Text = buffer
  26.  
  27.     End Sub