?
Solved

Executing PC games from a VB 6 form

Posted on 2002-05-08
3
Medium Priority
?
140 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 200 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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