Recently I got fed up with manually attaching to game process every time. I knew there were some macros that would search for given executable and attach automatically, I even found some of them. Sadly, it seems like API changes slightly with every release, so couldn’t get any of them to work with MSVC2010. In the end, I just hacked my own one, attaching it below (MSVC2010, probably won’t work with any other version).
Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports EnvDTE90a Imports EnvDTE100 Imports System.Diagnostics Imports System.Security.Principal Imports System.Windows.Forms Public Module DebugHelpers Sub AttachToExe() If Not (AttachToProcess("MY_EXE0.exe")) Then If Not AttachToProcess("MY_EXE1.exe") Then MessageBox.Show("Can't find EE executable") End If End If End Sub Function AttachToProcess(ByVal ProcessName As String) As Boolean Dim processFound = False Try Dim processes As EnvDTE.Processes = DTE.Debugger.LocalProcesses If processes.Count = 0 Then MessageBox.Show("No processes are running on this machine.", _ "Error") Else For Each proc As EnvDTE.Process In processes If proc.Name.IndexOf(ProcessName) >= 0 Then proc.Attach() processFound = True Exit For End If Next End If Catch ex As System.Exception MsgBox(ex.Message) End Try AttachToProcess = processFound End Function End Module
Just create a new macro, customize it to search for executable of your choice, bind it to some key combination (Ctrl+Alt+D for me) and you should be good to go.