Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Basic help with VB

  • 06-11-2003 2:39pm
    #1
    Registered Users, Registered Users 2 Posts: 4,946 ✭✭✭


    Hey, im dabbling in VB for personal interest and im writing a program that will take in ips and passwords then execute a game application.

    Whats the command that would be used to run a game executable?

    I have a bat file i wrote that will do it for me, but that means that i have to keep editing the bat file in order to connect to a server, so i want to make 2 sperate boxes one for the ip and another for the password to a game server. All i need is the command!

    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    
    Shell("c:\some folder\game.exe")
    
    

    will launch your game taken that the exe is called game and in the 'some folder' folder. That's it at its most basic. You could look at the ShellExecute api call too, if you were interested.


  • Closed Accounts Posts: 7,230 ✭✭✭scojones




  • Registered Users, Registered Users 2 Posts: 4,946 ✭✭✭red_ice


    Thats excellent lads, thanks loads


  • Registered Users, Registered Users 2 Posts: 5,335 ✭✭✭Cake Fiend


    Just as a useless side-note, you could write a batch file to take two external parameters as ip and password.
    e.g. connect.bat containing something along the lines of

    c:\games\half-life\hl.exe -game cstrike -connect %1 -password %2

    or whatever.
    Then run connect.bat <ip> <password>.


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    If there are gona be other users on the machine, then that is not a safe way of doing that.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 4,946 ✭✭✭red_ice


    Originally posted by Sico
    Just as a useless side-note, you could write a batch file to take two external parameters as ip and password.
    e.g. connect.bat containing something along the lines of

    c:\games\half-life\hl.exe -game cstrike -connect %1 -password %2

    or whatever.
    Then run connect.bat <ip> <password>.

    yer, i dont know how to do that - but i used a batch file all the time in england for a week when i was playing with my old clan.

    I was going to use the batch file that they had but taht envolved me having to edit it all the time.

    So what i want to do with this is just have a box for ips, another for pw, then take the ip and the pw and add them to the end of the cmd in basic.

    When i use Shell("c:\some folder\game.exe") or ShellExecute i get an error and the program dies, so no joy as of yet.

    I dont know VB at all, but i know how to make stupid programs with it, that show values n stuff - but getting a program to execute (which is more than likely very easy) is proving to annoy me
    ShellExecute ("C:\Program Files\Steam\Steam.exe -applaunch 10 -connect" +addressin+" -password" +passwordin+)
    addressin and passwordin is the ip and pw, but its prompting me to add an expression to the end of that sentence
    ShellExecute hWnd, "find", "C:\Program Files\Steam\Steam.exe -applaunch 10", _
    vbNullString, vbNullString, SW_SHOWNORMAL

    This does nothing, but since its on a cmd button, should it not just start the program anyway? Like a shortcut?


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    you need to dim a variable to hold your parameters
    dim sMyVar as string
    sMyVar ="-applaunch 10 -connect" +addressin+" -password" + passwordin

    ShellExecute ("C:\Program Files\Steam\Steam.exe " + sMyVar)

    I just used something similar to lunch HL/Quake and it worked
    in order to test your line you
    could go to Start-Run and enter the program name with parameters and see if it works i.e
    C:\Program Files\Steam\Steam.exe -applaunch 10 -connect123.45.67.89 -password MyPassword
    if this doesn;t work then it won't work in vb


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Just as a side note use ampersand ( & ) to join your strings + is for numerical addition and vb might think you're adding numbers as variants. T'is better that way :)


  • Registered Users, Registered Users 2 Posts: 5,335 ✭✭✭Cake Fiend


    Originally posted by sjones
    If there are gona be other users on the machine, then that is not a safe way of doing that.

    Well I assumed he'd be running it through an mirc alias or some such.
    Speaking of which, you could easily set up an mirc popup to do the same thing.


Advertisement