Passing info from one program to another *Tutorial*

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts Page 1 of 1
Contributors
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

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-
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

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)
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

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
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

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
User avatar
CodenBoy
Top Poster
Top Poster
Posts: 103
Joined: Sun Jul 15, 2012 4:06 pm

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
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

#comathi nice tutorial !! :D
Find my programs on Softpedia
6 posts Page 1 of 1
Return to “Tutorials”