Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: EndTwist on September 09, 2003, 10:17:52 pm

Title: Retrieve game name list? (programming Q)
Post by: EndTwist on September 09, 2003, 10:17:52 pm
Hopefully someone can answer this for me:

1. How do I retrieve the MAME game list from VB? I've tried ShellExecute, Shell, and other various functions, but nothing works. The arguments I send are "-listfull >c:\filename.txt", but it won't save. I've also tried without the c:\, but it WILL NOT SAVE!

2. How do I get the names of NES games? Header?
Title: Re:Retrieve game name list? (programming Q)
Post by: SirPoonga on September 10, 2003, 12:16:50 am
shell should work.  However you won't know when the execution is done.  Look on deja.com for ShellAndWait.  It VB code that uses windows api to execute and wait for finish of execution.

BTW, it's easier to parse -listxml since you can use Microsoft XML 4.0 DOM docs in VB.
Title: Re:Retrieve game name list? (programming Q)
Post by: DinoRoger on September 10, 2003, 12:38:20 am
Here is the Shell Wait code I use in most of my apps (VB6):

Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "Kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400


Sub Shell32Bit(ByVal JobToDo As String)
  On Error Resume Next
  Dim hProcess As Long
  Dim RetVal As Long
  hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(JobToDo, 3))
    Do
      GetExitCodeProcess hProcess, RetVal
      DoEvents: Sleep 100
    Loop While RetVal = STILL_ACTIVE
End Sub


Example Use = Shell32Bit ("C:\MAME -fulllist > C:\ROMDUMP.txt")
Title: Re:Retrieve game name list? (programming Q)
Post by: SirPoonga on September 10, 2003, 03:42:53 am
Don't you need to include some api calls there?
Title: Re:Retrieve game name list? (programming Q)
Post by: DinoRoger on September 10, 2003, 12:50:19 pm
Sorry forgot that. Modified my post with all code this time.
Title: Re:Retrieve game name list? (programming Q)
Post by: EndTwist on September 10, 2003, 03:32:08 pm
It still doesn't seem to work (I'm testing it on MAME 0.73)

Here is what I'm using:

Private Sub Form_Click()
Call Shell32Bit("C:\MAME\MAME -listfull > C:\ROMDUMP.txt")
End Sub

It shows the DOS window, but it wont save?! If I do it from the command prompt, it works, but otherwise--no?   ???
Title: Re:Retrieve game name list? (programming Q)
Post by: Minwah on September 10, 2003, 03:46:56 pm
It still doesn't seem to work (I'm testing it on MAME 0.73)

Here is what I'm using:

Private Sub Form_Click()
Call Shell32Bit("C:\MAME\MAME -listfull > C:\ROMDUMP.txt")
End Sub

It shows the DOS window, but it wont save?! If I do it from the command prompt, it works, but otherwise--no?   ???

Try this:

Call Shell32Bit("CMD.EXE /c C:\MAME\MAME -listfull > C:\ROMDUMP.txt")

(replace cmd.exe with command.com for Win98)
Title: Re:Retrieve game name list? (programming Q)
Post by: EndTwist on September 10, 2003, 03:50:51 pm
[dramatic music]ba-ba-ba-baaaaa!

And that was the catch...It works!

Thanks everyone!  :D