Public Class Form1
Private Sub SuspendProcess(ByVal process As System.Diagnostics.Process)
For Each t As ProcessThread In process.Threads
Dim th As IntPtr
th = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
If th <> IntPtr.Zero Then
SuspendThread(th)
CloseHandle(th)
End If
Next
End Sub
Private Sub ResumeProcess(ByVal process As System.Diagnostics.Process)
For Each t As ProcessThread In process.Threads
Dim th As IntPtr
th = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
If th <> IntPtr.Zero Then
ResumeThread(th)
CloseHandle(th)
End If
Next
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim game As Process() = Process.GetProcessesByName(TextBox1.Text)
If Label1.Text = "Suspend" Then
SuspendProcess(game(0))
Label1.Text = "Resume"
Me.Close()
Else
ResumeProcess(game(0))
Label1.Text = "Resume"
ผมจะต้องประกาศ IF ตรงไหนหรอครับเพื่อที่จะ Resume ไฟล์นั้นๆ