[DllImport("kernel32.dll")]
static extern int SuspendThread(IntPtr hThread);
<DllImport("kernel32.dll")> _
Function SuspendThread(hThread As IntPtr ) As Integer
End Function
None.
None.
Please add some!
public static void SuspendProcess(uint pid)
{
Process p = Process.GetProcessById((int)pid);
foreach (ProcessThread thd in p.Threads)
{
IntPtr threadHandle = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)thd.Id);
if (threadHandle == IntPtr.Zero)
{
throw new Win32Exception((int)GetLastError());
}
if (SuspendThread(threadHandle) == -1)
{
CloseHandle(threadHandle);
throw new Win32Exception((int)GetLastError());
}
CloseHandle(threadHandle);
}
}
Do you know one? Please contribute it!