Advertisement
tabnation

suspend any game

Feb 22nd, 2022
187
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None
  1. InputBox, UserInput, Game, Please enter a exe name with file ext
  2. ;WinGetActiveTitle , UserInput
  3.  
  4. f1::
  5. if (toggle := !toggle)
  6. {
  7. Process_Suspend(UserInput)
  8. }
  9. else
  10. {
  11. Process_Resume(UserInput)
  12. }
  13.  
  14. Process_Suspend(PID_or_Name){
  15. PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
  16. h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
  17. If !h
  18. Return -1
  19. DllCall("ntdll.dll\NtSuspendProcess", "Int", h)
  20. DllCall("CloseHandle", "Int", h)
  21. Return
  22. }
  23.  
  24. Process_Resume(PID_or_Name){
  25. PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name
  26. h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid)
  27. If !h
  28. Return -1
  29. DllCall("ntdll.dll\NtResumeProcess", "Int", h)
  30. DllCall("CloseHandle", "Int", h)
  31. }
  32.  
  33. ProcExist(PID_or_Name=""){
  34. Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name
  35. Return Errorlevel
  36. }
  37. return
  38.  
Advertisement
RAW Paste Data Copied
Advertisement