@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The SuspendThread API !!!!C# Signature: [DllImport("kernel32.dll",SetLastError=true)] static extern int SuspendThread(IntPtr hThread); !!!!VB Signature: <DllImport("kernel32.dll",SetLastError:=True)> _ Function SuspendThread(hThread As IntPtr ) As Integer End Function !!!!Boo Signature: [DllImport("kernel32.dll")] def SuspendThread(threadHandle as IntPtr) as int: pass !!!!User-Defined Types: None. !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: using System.Runtime.InteropServices; using System.ComponentModel; public class ProcessSuspend { const int THREADACCESS_SUSPEND_RESUME = 0x0002; [DllImport("kernel32.dll",SetLastError=true)] static extern int SuspendThread(IntPtr hThread); [DllImport("kernel32.dll")] static extern uint GetLastError(); 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); // Open thread with required permissions if (threadHandle == IntPtr.Zero) // If thread pointer is zero, means that the 'OpenThread' function has failed { throw new Win32Exception((int)GetLastError()); } if (SuspendThread(threadHandle) == -1) // If the result is -1, the funtion has failed { CloseHandle(threadHandle); throw new Win32Exception((int)GetLastError()); } CloseHandle(threadHandle); // Don't forget close thread handle } p.Dispose(); } } !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: SuspendThread@msdn on MSDN
Edit kernel32.SuspendT...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.