I have a problem I try to send a message to a combobox on a app , the problem is there are two combobox with the same name ,my code is hitting the first one ,but I need it to send to the second one not the first one. How do i make loop though and send message to the second combobox? here me code
d Code:
  1. Option Explicit
  2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  3. 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
  4. Private 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
  5. Private Const WM_SETTEXT = &HC
  6. Private Const BM_CLICK = &HF5
  7. Private Const WM_SETFOCUS = &H7
  8.  
  9.  
  10.  
  11.  
  12. Private Sub Command1_Click()
  13. Dim nPad As Long, editx As Long
  14.      nPad = FindWindow(vbNullString, "Login to NetZero")
  15.    editx = FindWindowEx(nPad, 0&, "zuicombobox", vbNullString)
  16.      If editx Then
  17.     Call SendMessageByString(editx, WM_SETTEXT, 0, "portland")
  18.     Text1.Text = "found it"
  19.     Else
  20.     Text1.Text = "No find"
  21.    
  22.     'Call SendMessageByString(editx, BM_CLICK, 0, "Send Some")
  23. End If
  24. End Sub