Solved

Executing PC games from a VB 6 form

Posted on 2002-05-08
3
136 Views
Last Modified: 2010-05-02
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
Comment
Question by:padawan76
3 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 50 total points
ID: 6997198
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
 
LVL 22

Expert Comment

by:rspahitz
ID: 6997467
In some cases, you may need to prefix it with "start":

Shell "Start myGame.exe"
0
 

Author Comment

by:padawan76
ID: 6997601
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question