I managed to tweak the code and get it to work fine with the first part of my VNC issue.
The following code passes the IP, and tells it to press the OK Button:
Code:Private Sub Command1_Click() Dim lHnd As Long 'parent window handle Dim lhndChild As Long 'child window handle Dim lngresult As Long Dim btnHnd As Long 'added to hit the OK button as experiment. lHnd = FindWindow(vbNullString, "VNC Viewer : Connection Details") 'this will return the 'VNC Viewer : Connection Details " windows Handle lhndChild = FindWindowEx(lHnd, 0&, "ComboBox", vbNullString) 'this will return the combo box handle. lngresult = SendMessage(lhndChild, WM_SETTEXT, 0&, ByVal (txtIP.Text)) 'Sends whatever is in the txtIP textbox that I created on my form lHnd = FindWindow(vbNullString, "VNC Viewer : Connection Details") If lHnd <> 0 Then btnHnd = FindWindowEx(lHnd, 0, "Button", "OK") 'makes it hit the OK button If btnHnd <> 0 Then SendMessage btnHnd, BM_CLICK, 0, 0& End If End If End Sub




Reply With Quote