try this just an example that will clear your concepts
Dim hWndApp As LongDim sApplication As StringDim hWndChild As LongDim sBuffer As String * 32Dim nSize As Long hWndApp = FindWindow("ThunderRT6FormDC", "Password")hWndButton = FindWindowEx(hWndApp, 0, "ThunderRT6CommandButton", "&Ok")hWndChild = FindWindowEx(hWndApp, 0, "ThunderRT6TextBox", "") If hw ThenhWndChild = GetWindow(hWndApp, GW_CHILD) Do While hWndChild <> 0 'get the Class Name of the window nSize = GetClassName(hWndChild, sBuffer, 32) 'MsgBox hWndChild 'if nSize > 0, it contains the length 'of the class name retrieved If nSize Then 'if the class name is "Edit", 'set some text and exit If Left$(sBuffer, nSize) = "ThunderRT6TextBox" Then Call SendMessage(hWndChild, WM_SETTEXT, 0&, ByVal passcode) hWndChild = GetWindow(hWndChild, GW_HWNDNEXT) Call SendMessage(hWndChild, WM_SETTEXT, 0&, ByVal login) Call SendMessage(hWndButton, BM_CLICK, 0, 0) Exit Sub End If End If 'not found, so get the next hwnd hWndChild = GetWindow(hWndChild, GW_HWNDNEXT) Loop End If