Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to write a small frontend for MAME. Here is the code I use to start MAME:

 

Dim startInfo As New ProcessStartInfo("j:\mame\mame.exe")

startInfo.Arguments = ListBox1.SelectedItem 'game name here.

startInfo.UseShellExecute = True

Process.Start(startInfo)

 

The problem is right after MAME loading the game it just closes the window, but my frontend remains. :confused: Is there anyway to around this problem. Or is there any other ways to do the same thing?

 

Thanks in advance.

  • Leaders
Posted

To start a process and keep track of the process, you need to declare a new instance of it , eg:

       Dim info As New ProcessStartInfo("iexplore.exe")
       info.UseShellExecute = True
       info.Arguments = "http://msn.co.uk" '/// carry out any additional arguments, eg: navigate to a webpage in this case

       Dim proc As New Process '/// create a new instance of the Process Class

       proc.StartInfo = info

       proc.Start()

if you are using a Console Application and it's dissapearing after a process has started, you can add ' Console.ReadLine() ' after the code that starts the process. ( if you wish to keep the Console window open that is )

Posted

Here is the new code:

 

Dim startInfo As New ProcessStartInfo("j:\mame\mame.exe")

Dim proc As New Process

startInfo.Arguments = ListBox1.SelectedItem

startInfo.UseShellExecute = True

proc.Start(startInfo).WaitForExit()

 

The result is the same. It quits after it loaded the game.

  • *Experts*
Posted

I'm guessing that you need to set a "startup folder" for the process. Meaning, your program isn't running from "j:\mame" so you need to tell mame to run from that folder. When MAME starts up, it's trying to locate other files in YOUR program's folder rather than in "j:\mame" and it's "crashing" out.

 

Note: I see that you're providing the full path to the EXE, but that's not the same as "the folder where the program is running from".

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...