• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

Executing PC games from a VB 6 form

How can you execute newer PC games such as Return to Castle Wolfenstein and Medal of Honor from a Visual Basic 6 form? I'm writing a video game menu program that executes PC games with the click of a button.  It works with some games but not any that involve the use of a DOS type console at the start of the game.
The program works if you keep the .exe for the menu in the same folder as the .exe of the game. But since there is more than one game that uses startup DOS consoles I can't do that. The code that I'm using the execute the games so far is:

Dim X as Long
X = Shell("path to game", 3)

I'm hip on any ideas even if I have to write the code in a language other than VB.

0
padawan76
Asked:
padawan76
1 Solution
 
jgvCommented:
Not sure what your problem is exactly but it sounds like setting the default directory to the game folder fixes the problem. You could give this a try:

ChDir "C:\Program Files\GameFolder"
Shell "TheGame.exe", 3
0
 
rspahitzCommented:
In some cases, you may need to prefix it with "start":

Shell "Start myGame.exe"
0
 
padawan76Author Commented:
I added the ChDir line that you mentioned and my program worked on the first try!
You rock and thank you so much!!!!!!

 
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now