Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Suspend/Resume
- #include <Misc.au3>
- #RequireAdmin
- Local $tengame, $thumuc
- Run($tengame,$thumuc)
- MsgBox(0,"","Nhấn Ctrl+A để treo game"&@CR&"Nhấn Ctrl+S để Resume")
- HotKeySet("{ESC}","Action")
- While 1
- If _IsPressed(11,'user32.dll') and _IsPressed(41,'user32.dll') then _ProcessSuspend($tengame)
- WEnd
- Func Action()
- _ProcessResume($tengame)
- EndFunc
- Func _ProcessSuspend($process)
- $processid = ProcessExists($process)
- If $processid Then
- $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
- $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
- DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
- If IsArray($i_sucess) Then
- Return 1
- Else
- SetError(1)
- Return 0
- Endif
- Else
- SetError(2)
- Return 0
- Endif
- EndFunc
- Func _ProcessResume($process)
- $processid = ProcessExists($process)
- If $processid Then
- $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
- $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
- DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
- If IsArray($i_sucess) Then
- Return 1
- Else
- SetError(1)
- Return 0
- Endif
- Else
- SetError(2)
- Return 0
- Endif
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement