Results 1 to 2 of 2

Thread: Problem sending text to 2th external edit box

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Problem sending text to 2th external edit box

    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

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Problem sending text to 2th external edit box

    Hai tony,

    Try to find a unique style in that control using spy++ , so can identify that control uniquely by issuing EnumChildWindows()


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width