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:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 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 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 Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) 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 Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean Private Declare Function SendMessageA Lib "user32" (ByVal hwnd As Long, ByVal _ wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 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 Public Const WM_SETTEXT = &HC
Button code:
2 Code:
Private Sub Command1_Click() Dim mywindowclass As Long Dim wtlsplitterwindow As Long Dim x As Long Dim Button As Long Dim atld As Long atld = FindWindow("atl:0053d390", vbNullString) wtlsplitterwindow = FindWindowEx(atld, 0&, "wtl_splitterwindow", vbNullString) wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString) wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString) x = FindWindowEx(wtlsplitterwindow, 0&, "#32770", vbNullString) editx = FindWindowEx(x, 0&, "edit", vbNullString) Call SendMessageByString(editx, WM_SETTEXT, 0&, Text1) End Sub




Reply With Quote