Custom Launch for exe's? Need help

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
18 posts Page 1 of 2
User avatar
Esky
VIP - Donator
VIP - Donator
Posts: 86
Joined: Tue Dec 22, 2009 11:36 am

Custom Launch for exe's? Need help
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?
Current Project: Server Browser - Beta & Text based MMORPG
Image
NoWayIn
VIP - Donator
VIP - Donator
Posts: 444
Joined: Sat Nov 21, 2009 11:16 pm

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 =
User avatar
Esky
VIP - Donator
VIP - Donator
Posts: 86
Joined: Tue Dec 22, 2009 11:36 am

Re: Custom Launch for exe's? Need help
Esky
No, but kinda the idea. I have 2 programs... wait ill make a picture diagram :P

Ok this is what i mean
You do not have the required permissions to view the files attached to this post.
Current Project: Server Browser - Beta & Text based MMORPG
Image
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

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 all
System.Diagnostics.Process.Start("C:\MyProgram.exe")
Hope that helps.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Esky
VIP - Donator
VIP - Donator
Posts: 86
Joined: Tue Dec 22, 2009 11:36 am

Re: Custom Launch for exe's? Need help
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
Current Project: Server Browser - Beta & Text based MMORPG
Image
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Hello,

You should be able to grab the command arguments used by using:
Code: Select all
Command()
For example if I started the program with MyProgram.exe somecommandtext then used this code in its "Form_Load" event:
Code: Select all
Msgbox(Command())
Then it would show a message box with the text "somecommandtext" inside it.

You could use it like you wanted like:
Code: Select all
If Command() = "somecommandtext" then
'DO THIS
Else
'DO THIS INSTEAD
End If
Is that what you mean? :?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
NoWayIn
VIP - Donator
VIP - Donator
Posts: 444
Joined: Sat Nov 21, 2009 11:16 pm

What do you mean by "Command1" ?
Code: Select all
If 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
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Hello,

This code works when starting a program with commands from vb:
Code: Select all
Dim App As New Process
        App.StartInfo.FileName = "C:\MyProgram.exe"
        App.StartInfo.Arguments = "command1"
        App.Start()
Happy coding! cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Toxikr3
Dedicated Member
Dedicated Member
Posts: 69
Joined: Tue Dec 08, 2009 12:49 am

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.
User avatar
Esky
VIP - Donator
VIP - Donator
Posts: 86
Joined: Tue Dec 22, 2009 11:36 am

Re: Custom Launch for exe's? Need help
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!
Current Project: Server Browser - Beta & Text based MMORPG
Image
18 posts Page 1 of 2
Return to “Tutorial Requests”