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: Game Switching Without Frontend?  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

copious

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:July 15, 2013, 11:20:09 am
  • I'm a llama!
Game Switching Without Frontend?
« on: December 01, 2008, 12:38:19 pm »
Here's the project I have a very nice condition Dragons Lair cabinet and I want to put Daphne running Dragons Lair HD in it. Addtionally, I thought why not add Space Ace HD and 'HOT' swap between the 2 games with a shifted key.

I could use a menu and all the bells but I thought this would make it look more realistic. Is there a program that I can use to kill one instance and start another with a hot key?

(+_+)

  • Let me splain.
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 652
  • Last login:July 27, 2012, 09:00:32 pm
  • For I am ]{eyser Soze
Re: Game Switching Without Frontend?
« Reply #1 on: December 01, 2008, 01:09:34 pm »
You could probably write a small program that will call a batch file to kill the process

TASKKILL /F /IM "notepad.exe"

or write a small program that uses the functions below to check if the process is running and then kill the process with the second function below. There is more to it than just that though since you need winapi references. Are you familiar with VB? I could send you the module you would need to make it happen.

Public Function Is_Process_Running(ProcessName As String) As Boolean
Dim Snapshot As Long
Dim Process As PROCESSENTRY32
Dim Success As Long

Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)

If Snapshot = -1 Then Exit Function

Process.dwSize = Len(Process)
Success = ProcessFirst(Snapshot, Process)

If Success = 1 Then
   Do
      If InStr(1, Process.szexeFile, ProcessName) > 0 Then
         Is_Process_Running = True
         Call CloseHandle(Snapshot)

         Exit Function
      End If
   Loop While ProcessNext(Snapshot, Process)
End If

Call CloseHandle(Snapshot)

End Function


Public Sub Kill_Process(ProcessName As String)
Dim uProcess As PROCESSENTRY32
Dim RProcessFound As Long
Dim Snapshot As Long
Dim SzExename As String
Dim ExitCode As Long
Dim MyProcess As Long
Dim AppKill As Boolean
Dim AppCount As Integer
Dim i As Integer
Dim WinDirEnv As String
Dim Response As Integer
       
If ProcessName <> "" Then
   AppCount = 0

   uProcess.dwSize = Len(uProcess)
   Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
   RProcessFound = ProcessFirst(Snapshot, uProcess)

   Do
      i = InStr(1, uProcess.szexeFile, Chr(0))
      SzExename = LCase$(Left$(uProcess.szexeFile, i - 1))
      WinDirEnv = Environ("Windir") + "\"
      WinDirEnv = LCase$(WinDirEnv)
     
      If Right$(SzExename, Len(ProcessName)) = LCase$(ProcessName) Then
         Response = MsgBox("There is a cmd.exe session already running." & vbCrLf & "It may be an orphaned session." & vbCrLf & vbCrLf & _
            "Do you want to terminate the session?", vbYesNo, "Potential Orphaned Session")
     
         If Response = vbYes Then
            AppCount = AppCount + 1
            MyProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
            AppKill = TerminateProcess(MyProcess, ExitCode)
            Call CloseHandle(MyProcess)
         End If
      End If
     
      RProcessFound = ProcessNext(Snapshot, uProcess)
   Loop While RProcessFound
   
   Call CloseHandle(Snapshot)
End If

End Sub
This plan is so perfect, it's retarded. -- Peter Family Guy

copious

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:July 15, 2013, 11:20:09 am
  • I'm a llama!
Re: Game Switching Without Frontend?
« Reply #2 on: December 01, 2008, 02:12:42 pm »
While I don't know VB I do know some people that do. If you can send it to me that would be great.