Hi! I don't have much experience using API calls, but I am trying to write some code to fill in the username, password and click the OK button. I have been able to get the control handles with FindWindowEx and tried using SetWindowText to write the info, but it didn't work right. I have the Analyzer.exe from the APIGuide website and it confirms the name and password were written to the edit boxes, but they are not visible and clicking the OK button doesn't satisfy the requirements - the logon box comes right back up. Is there a better API call or a better method to use? Any suggestions are appreciated. Here's the code I tried: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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Dim tWnd As Long, bWnd As Long, cWnd As Long, ncWnd As Long
Private Sub main()
'Get the logon window handle
tWnd = FindWindow("#32770", vbNullString)
'Get the username's window handle
bWnd = FindWindowEx(tWnd, ByVal 0, "EDIT", vbNullString)
'paste in username
myuser = "user" & Chr$(0)
SetWindowText bWnd, myuser
'get password window handle
cWnd = FindWindowEx(tWnd, bWnd, "EDIT", vbNullString)
'paste in password
mypass = "password" & Chr$(0)
SetWindowText cWnd, mypass
'if this works, need to focus and click the OK button or sendkey "enter"
End Sub