Advertisement
toan9xpro2012

DIs

Sep 25th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.28 KB | None | 0 0
  1. ;Suspend/Resume
  2. #include <Misc.au3>
  3. #RequireAdmin
  4. Local $tengame, $thumuc
  5. Run($tengame,$thumuc)
  6. MsgBox(0,"","Nhấn Ctrl+A để treo game"&@CR&"Nhấn Ctrl+S để Resume")
  7.  
  8. HotKeySet("{ESC}","Action")
  9.  
  10. While 1
  11. If _IsPressed(11,'user32.dll') and _IsPressed(41,'user32.dll') then _ProcessSuspend($tengame)
  12. WEnd
  13.  
  14. Func Action()
  15.     _ProcessResume($tengame)
  16. EndFunc
  17.  
  18. Func _ProcessSuspend($process)
  19. $processid = ProcessExists($process)
  20. If $processid Then
  21. $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
  22. $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
  23. DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
  24. If IsArray($i_sucess) Then
  25. Return 1
  26. Else
  27. SetError(1)
  28. Return 0
  29. Endif
  30. Else
  31. SetError(2)
  32. Return 0
  33. Endif
  34. EndFunc
  35.  
  36. Func _ProcessResume($process)
  37. $processid = ProcessExists($process)
  38. If $processid Then
  39. $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
  40. $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
  41. DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
  42. If IsArray($i_sucess) Then
  43. Return 1
  44. Else
  45. SetError(1)
  46. Return 0
  47. Endif
  48. Else
  49. SetError(2)
  50. Return 0
  51. Endif
  52. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement