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:
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 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 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 Private Const WM_SETTEXT = &HC Private Const BM_CLICK = &HF5 Private Const WM_SETFOCUS = &H7 Private Sub Command1_Click() Dim nPad As Long, editx As Long nPad = FindWindow(vbNullString, "Login to NetZero") editx = FindWindowEx(nPad, 0&, "zuicombobox", vbNullString) If editx Then Call SendMessageByString(editx, WM_SETTEXT, 0, "portland") Text1.Text = "found it" Else Text1.Text = "No find" 'Call SendMessageByString(editx, BM_CLICK, 0, "Send Some") End If End Sub




Reply With Quote