Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: VB Developers question  (Read 1453 times)

0 Members and 1 Guest are viewing this topic.

danpomeroy

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:November 20, 2007, 12:41:40 pm
VB Developers question
« on: November 19, 2007, 05:44:23 pm »
I can shell out to MAME but when I add the rom name it won't load. With no rom name, mame loads but says there are no roms even though there is. Any Ideas?

VB2005

SGT

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1146
  • Last login:May 31, 2025, 10:10:32 pm
Re: VB Developers question
« Reply #1 on: November 19, 2007, 06:34:48 pm »
Its a working directory problem.  Before shelling out, use CHDRIVE and CHDIR to the directory where mame is located.   That way, MAME can find the MAME.INI file (if it exists) and the ROMS folder.

Code: [Select]
    ChDrive ("e:")
    ChDir ("\emulators\mame")
    Shell ("mame.exe pacman")

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: VB Developers question
« Reply #2 on: November 19, 2007, 07:03:28 pm »
This is VB 2005 though. So you really want to use the System.Diagnostics.Process namespace.

Code: [Select]
Private Sub LaunchGame(ByVal GameName As String)
   Dim myProcess As Process = New Process
   AddHandler myProcess.Exited, AddressOf MameExited
   myProcess.StartInfo.WorkingDirectory = "E:\Emulators\Mame"
   myProcess.StartInfo.FileName = "E:\Emulators\Mame\Mame.exe"
   myProcess.StartInfo.Arguments = GameName
   myProcess.StartInfo.CreateNoWindow = True
   myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
   myProcess.EnableRaisingEvents = True
   myProcess.Start()
End Sub

Private Sub MameExited(ByVal sender As Object, ByVal e As System.EventArgs)
   MessageBox.Show("Mame exited!")
End Sub

SGT

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1146
  • Last login:May 31, 2025, 10:10:32 pm
Re: VB Developers question
« Reply #3 on: November 19, 2007, 07:43:08 pm »
What is the advantage?

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: VB Developers question
« Reply #4 on: November 19, 2007, 08:46:26 pm »
What is the advantage?

No great advantage, but Process is a handy namespace to get used to working with. It can tell you when a process has exited and hide the Command Line window for example. It gives you more control over the legacy Shell() method from VB6. It's really just the standard way to launch a process using VB.NET, but you get the same result in the end I guess ;)