Solved

Executing PC games from a VB 6 form

Posted on 2002-05-08
3
133 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now