example code:
Process p = Process.GetCurrentProcess();
foreach (ProcessThread t in p.Threads)
{
if (t.Id == 1111)
// u cant abort this tread, abort method wont available for this thread
}
So how can i kill this thread? is it possible? Yes i did this using win32 programming
My Code: i declare below codes.
[DllImport("Kernel32.dll")]
public static extern Int32 OpenThread(Int32 dwDesiredAccess, Int32 bInheritHandle, Int32 dwThreadId);
[DllImport("Kernel32.dll")]
public static extern Int32 TerminateThread(Int32 hThread, Int32 dwExitCode);
So that i call these funaction to kill any thread :) like ,
Int32 threadHandle = OpenThread(0x1F03FF, 1, t.Id);
TerminateThread(threadHandle, 0);
Please let me know if you know any other method .
No comments:
Post a Comment