get vb.net to type into a 3rd party application

Joined
Jun 26, 2007
Messages
7
Programming Experience
Beginner
Hi is there a way to get an appliction ive written to get a value from a text box in my ap[plication and put it into a text box of another application that i have downloaded.

Basically on my form is details of a user on our network, on of them being "hostname" , when you click a button by the hostname it launches an application we use to remote contol hosts pcs on our network, what i want it to do is put the hostname on my form in to the text box of the 3rd party application we use to remote to the pc.

Hope you can help :)
 
Figure out how to navigate to that textbox with keyboard, for example when that app start you press Tab key 3 times to get to the textbox:
VB.NET:
SendKeys.Send("{TAB 3}hostname")
SendKeys sends to the currently active application. After the other app process is started or if it's already running you need to activate it since your own app now is active:
VB.NET:
AppActivate(Title As String or ProcessId As Integer)
 
the first bit works perfectly, but the app that it should be typed into isnt always the active application, how do i ensure it is before sending the text? i cant usae the process id as it changes every time

thank you
 
Use the Title as indicated. "title in the title bar of the application" as they say, first parts of it is also valid (also case insensitive).

If you by saying "cant usae the process id as it changes every time" mean that you start new process instance, then you can also read it from there.
 
System.Diagnostics.Process.Start("C:\Program Files\DameWare Development\DameWare Mini Remote Control\DWRCC.exe")
AppActivate("DameWare Mini Remote Control")
SendKeys.Send(hostname1.Text)

This is my code and for somereason it doesnt work?

when the application is open, the text box that needs the hostname written in is the first box selected.
 
Use API calls to find the window handle of the hostname textbox and send it a WM_SETTEXT command instead
 
This is my code and for somereason it doesnt work?
App probably haven't opened the window yet, try this:
VB.NET:
        Dim pcs As Process = Process.Start("C:\Program Files\DameWare Development\DameWare Mini Remote Control\DWRCC.exe")
        pcs.WaitForInputIdle()
        AppActivate(pcs.Id)
        SendKeys.Send(hostname1.Text)
From the remarks of the WaitForInputIdle method:
This state is useful, for example, when your application needs to wait for a starting process to finish creating its main window before the application communicates with that window.
 
Back
Top