Page 1 of 1

Passing info from one program to another *Tutorial*

Posted: Sun Sep 25, 2011 4:27 pm
by comathi
Ok, so let's say you have a program, and from that program, you lauch another (using the Process.Start command). But there's one problem, you want the second program to use a string from the first one. Here's how:

1- In the first program, the one that will be sending the message, insert a button.
2- In the button's "Click" Event, insert this:
Code: Select all
Private sub Button1_Click (byval sender as object, byval e as system.eventargs) handles Button1.click

Process.Start("SecondProgram.exe","Message to send")
End Sub
That's all for the first program, now for the second:

3- Add a label to the form, in the Form's "Load" event, put this:
Code: Select all
Private sub Form1_Load (byval sender as object, byval e as system.eventargs) handles me.load

Dim str as String=Command()
Label1.Text=str
Label1.Refresh()

End Sub
That's all... Now, when you lauch the sender program and click on the button, the second program will launch and the label's text will be the sent message. I found this information on YouTube.
Hope this helps :D

-Comathi-

Re: Passing info from one program to another *Tutorial*

Posted: Sun Sep 25, 2011 4:55 pm
by M1z23R
You can also use
Code: Select all
 Dim ProcessProperties As New ProcessStartInfo
                ProcessProperties.FileName = "Updater.exe"
                ProcessProperties.Arguments = "Your 'Command'"
                ProcessProperties.WindowStyle = ProcessWindowStyle.Maximized
                Dim myProcess As Process = Process.Start(ProcessProperties)
Code: Select all
MsgBox(Command.ToString)

Re: Passing info from one program to another *Tutorial*

Posted: Thu Jul 26, 2012 1:34 pm
by CodenBoy
Nice tutorial :), it can be used for Notepad? i process.start(Notepad.exe) and paste some text on it xD? can it work? code ? XD!

Thanks

Re: Passing info from one program to another *Tutorial*

Posted: Thu Jul 26, 2012 8:20 pm
by mandai
it can be used for Notepad?
Notepad uses the first argument as the file name, though you can't set the text with this.

You can use SendMessage and WM_SETTEXT to set the text. This might be useful: viewtopic.php?f=21&t=5727&p=43511#p43452

Re: Passing info from one program to another *Tutorial*

Posted: Thu Jul 26, 2012 8:23 pm
by CodenBoy
Thanks mandai, i really like you and you are best helpful member here:)
i need 1 help if u wanan see my latest topic, its in New Topics in homepage on cns

Re: Passing info from one program to another *Tutorial*

Posted: Sat Jul 28, 2012 12:36 am
by Shim
#comathi nice tutorial !! :D