Guest User

Untitled

a guest
May 5th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Imports System
  2. Imports EnvDTE80
  3. Imports EnvDTE90
  4. Imports System.Diagnostics
  5.  
  6. Public Module Module1
  7. Sub RunAndAttach()
  8. Try
  9. Dim dbg As Debugger3 = DTE.Debugger
  10. Dim trans As Transport = dbg.Transports.Item("Default")
  11. Dim sysProc As Process = System.Diagnostics.Process.Start(New ProcessStartInfo("C:TempCrashingApp.exe") With {.WorkingDirectory = "C:Temp"})
  12. Dim proc As EnvDTE90.Process3 = dbg.GetProcesses(trans, "ALLON-PC").Item("CrashingApp.exe")
  13. If (Not sysProc.HasExited) Then
  14. proc.Attach()
  15. proc.Break(False)
  16. Else
  17. MsgBox("Process " + proc.Name + " has already has exited.")
  18. End If
  19. Catch ex As System.Exception
  20. MsgBox(ex.Message)
  21. End Try
  22. End Sub
  23.  
  24. End Module
Add Comment
Please, Sign In to add comment