Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » VB help, trying to start program
Closed Thread
Old 09-02-2008, 03:55 AM   #1 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,682

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default VB help, trying to start program

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.
__________________

Need website help? PM me!
CrazeD is offline  
Old 09-02-2008, 10:02 PM   #2 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Default Re: VB help, trying to start program

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

Last edited by StealthTools; 09-02-2008 at 11:03 PM.
StealthTools is offline  
Old 09-03-2008, 01:23 AM   #3 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,682

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: VB help, trying to start program

I am using Visual Basic Express 2008.

I will try that.
__________________

Need website help? PM me!
CrazeD is offline  
Old 09-03-2008, 12:27 PM   #4 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: VB help, trying to start program

Use this: Process Class (System.Diagnostics)
jaeusm is offline  
Old 09-03-2008, 03:26 PM   #5 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Default Re: VB help, trying to start program

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")  
  1. 'if the project u will make will be built in C:\
  2. beside that ,use'
  3. system.diagonestic.process.start("c:\myfile.exe")
  4. 'and it can be also used in opening sites if u typed the url instead of c:/...'
Hope that helps.
Note: I am upgrading to VB.net

Last edited by StealthTools; 09-03-2008 at 03:31 PM.
StealthTools is offline  
Old 09-04-2008, 02:35 AM   #6 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,682

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: VB help, trying to start program

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.
__________________

Need website help? PM me!
CrazeD is offline  
Old 09-04-2008, 12:10 PM   #7 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: VB help, trying to start program

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.
jaeusm is offline  
Old 09-04-2008, 07:43 PM   #8 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,682

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: VB help, trying to start program

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.
__________________

Need website help? PM me!
CrazeD is offline  
Old 09-04-2008, 09:26 PM   #9 (permalink)
StealthTools's Avatar
 
Hardware/VB.net/Anti-vir

Join Date: Mar 2008

Location: TN - Intel, Samsung, and NVIDIA 4 EvR!

Posts: 515

StealthTools is on a distinguished road

Send a message via MSN to StealthTools
Default Re: VB help, trying to start program

Interesting...

When you run a game using 'Process.Start' that is on a virtual CD it runs perfect.

Last edited by StealthTools; 09-04-2008 at 09:35 PM.
StealthTools is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
BFG Announces Graphics Card 100 Day Trade Up Program Osiris Other Computer HW Topics 5 03-18-2008 08:34 PM
Join The Windows Feedback Program and grab some free apps Osiris Windows Operating Systems and Software 4 12-14-2007 05:45 PM
friends log Static_11 HijackThis Logs (finished) 11 11-25-2007 10:27 PM