Hi all i am using the following code to send text to exteranl edit box. However, the current code sends the text to first edit box in exteranl window. How i can change the code so i be able to send text to the second edit box in external window too ? In my form i got 2 editbox and both got text and i want to send those texts to external window editboxes.Hope you guyes help me how this can done.Thanks

Module code:

2 Code:
  1. Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  2. Public 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
  3. Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
  4. Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
  5. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  6. Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
  7. Private Declare Function SendMessageA Lib "user32" (ByVal hwnd As Long, ByVal _
  8. wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  9. Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  10. Public Const WM_SETTEXT = &HC

Button code:
2 Code:
  1. Private Sub Command1_Click()
  2. Dim mywindowclass As Long
  3. Dim wtlsplitterwindow As Long
  4. Dim x As Long
  5. Dim Button As Long
  6. Dim atld As Long
  7. atld = FindWindow("atl:0053d390", vbNullString)
  8. wtlsplitterwindow = FindWindowEx(atld, 0&, "wtl_splitterwindow", vbNullString)
  9. wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
  10. wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
  11. x = FindWindowEx(wtlsplitterwindow, 0&, "#32770", vbNullString)
  12. editx = FindWindowEx(x, 0&, "edit", vbNullString)
  13. Call SendMessageByString(editx, WM_SETTEXT, 0&, Text1)
  14.  
  15. End Sub