VB help, trying to start program

Status
Not open for further replies.

CrazeD

Fully Optimized
Messages
3,736
Location
Maine
So, I'm new to pretty much any form of desktop programming. I'm gonna start out with VB, make some simple junk, then move onto something better.

So anyway, I'm trying to start a game with VB. More specifically, call of duty 4. The code opens simple exe's and bat's, but won't work with call of duty 4 or battlefield 2. In both cases, it says files are missing. Any clues as to why it would do that?

Code:

Code:
Public Class Form1
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Shell("C:\COD4\iw3mp.exe")
    End Sub
End Class

I've tried a few different ways of opening an exe that I found on Google, and they all had the same results.

Thanks.
 
Hmmm..

Do you have to declare the thing that opens the file?

Like...Notepad should open the text file "yourfile"
Code:
Shell "notepad.exe c:\yourfile.txt"

I wana know how to do this two now.. hmm.. i'll look more into it tomorrow.

^You are using VB.net.. I have Visual Basic 6.0
 
In vb.net I believe you can just use this to start your programs:
Example:
Code:
Process.Start("c:\MyFile.txt")
You may also use:
Code:
shell("myfile.exe")  
[LIST=1]
[*]'if the project u will make will be built in C:\
[*]beside that ,use'
[*]system.diagonestic.process.start("c:\myfile.exe")
[*]'and it can  be also used in opening sites if u typed the url instead of c:/...'
[/LIST]
Hope that helps.
Note: I am upgrading to VB.net :p
 
Code:
System.Diagnostics.Process.Start("c:\COD4\iw3mp.exe")

This doesn't work either.

I'm starting to think this isn't possible...or more difficult than I had foreseen.
 
If that is your exact line of code, it definitely won't work because each of your backslashes are causing the subsequent character to act as an escape character. Try using double slashes.
 
Well, it starts to launch the program but then I get an error from the game. I see the load screen, then an error saying the files aren't loading from the game directory.
 
Status
Not open for further replies.
Back
Top Bottom