Page 1 of 2
Custom Launch for exe's? Need help
Posted: Sat Dec 26, 2009 7:48 am
by Esky
Custom Lanuch for exe's? Need help
What i mean by this is i want to start an exe using another exe or a shortcut with a command applied to it... Some of you may know what im talking about, i want to be able to go Shell("program.exe +command") many games use this to change the res or other features, eg Shell("game.exe +width 800 +hight 600")
So what i want to know is how i do this for my exe?
Re: Custom Launch for exe's? Need help
Posted: Sat Dec 26, 2009 8:04 pm
by NoWayIn
You mean like a Launcher?
You can just make your form1 the Launcher and form2 and so on the Main form
it's easier that way
with form1 you just do
Form2.Show()
Form2.Width =
Form2.Height =
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 12:27 am
by Esky
No, but kinda the idea. I have 2 programs... wait ill make a picture diagram :P
Ok this is what i mean
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 12:56 am
by CodenStuff
Hello Esky,
Will you know where the program is located on the computer?. If so then you can just use something like the process start command:
Code: Select allSystem.Diagnostics.Process.Start("C:\MyProgram.exe")
Hope that helps.
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 1:09 am
by Esky
Ahh yes i understand up to that part im trying to learn how to launch an exe with a command eg
System.Diagnostics.Process.Start("C:\MyProgram.exe")
- Start program normaly
or
System.Diagnostics.Process.Start("C:\MyProgram.exe
+command1")
- Start program with a var/command
So im trying to find the Form/App startup code to do this from within the "MyProgram.exe"
Im assuming somthing around the lines of
Code: Select all Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Application.StartupPath = Application.StartupPath & " +command1" Then
'DO SOMTHING
Else
'START NORMALY
End If
End Sub
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 1:34 am
by CodenStuff
Hello,
You should be able to grab the command arguments used by using:
For example if I started the program with
MyProgram.exe somecommandtext then used this code in its "Form_Load" event:
Then it would show a message box with the text "
somecommandtext" inside it.
You could use it like you wanted like:
Code: Select allIf Command() = "somecommandtext" then
'DO THIS
Else
'DO THIS INSTEAD
End If
Is that what you mean? :?
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 1:34 am
by NoWayIn
What do you mean by "
Command1" ?
Code: Select allIf Application.StartupPath = Application.StartupPath & " +command1" Then
Let me use this example and see if it's like what you want :
so some online games have a Settings Tab where you can change settings like resolutions, window mode, etc
so Im guessing thats what you want your program to do?
Program A = Launcher
Program B = Main Program
In program A you go into settings and you made the size 500x500
you save the setting and click launch, then program B starts up and the size is 500x500
if this is what you want then just simply write the settings into a registry or a file, then let program B retrieve the settings
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 1:51 am
by CodenStuff
Hello,
This code works when starting a program with commands from vb:
Code: Select allDim App As New Process
App.StartInfo.FileName = "C:\MyProgram.exe"
App.StartInfo.Arguments = "command1"
App.Start()
Happy coding! cooll;
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 2:03 am
by Toxikr3
If you want a shortcut, you can make a shortcut of the exe, then go to Properties, Target textbox and add the command to it.
Inside your VB program you can use what CodenStuff said,
Command()
Using an If statement you can change the way your program responds.
Re: Custom Launch for exe's? Need help
Posted: Sun Dec 27, 2009 8:37 am
by Esky
OW MY GOD. I LOVE YOU ALL! ive been trying to find this method for about a year... ive been doing work-around using the registry and external files... and now! OMG I LOVE YOU ALL!
i know i must sound a little over excited right now but when you've been stuck on 1 problem for about a year and then a nice group of people show you the way you tend to be a lil happy!