1. 什么模块?只有appdomain是可以拆卸的。 2. Windows API.OpenThreadThe OpenThread function opens an existing thread object. HANDLE OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId );Parameters dwDesiredAccess [in] Access to the thread object. This access right is checked against any security descriptor for the thread. This parameter can be one or more of the thread access rights. bInheritHandle [in] If this parameter is TRUE, the new process inherits the handle. If the parameter is FALSE, the handle is not inherited. dwThreadId [in] Identifier of the thread to be opened. Return Values If the function succeeds, the return value is an open handle to the specified process.If the function fails, the return value is NULL. To get extended error information, call GetLastError.Res The handle returned by OpenThread can be used in any function that requires a handle to a thread, such as the wait functions, provided you requested the appropriate access rights. The handle is granted access to the thread object only to the extent it was specified in the dwDesiredAccess parameter.When you are finished with the handle, be sure to close it by using the CloseHandle function.
HANDLE hThread = OpenThread (THREAD_ALL_ACCESS, false, (DWORD)atoi(szID));
if(hThread != NULL)
{
::TerminateThread (hThread, 0)// 结束线程
}
private object pTemp = System.Diagnostics.Process.GetProcesses(); //获得进程集System.Diagnostics.Process pTempProcess; //寻找制定进程
foreach (int pTempProcess in pTemp) {pTempProcess.ProcessName //这个是进程名字 pTempProcess.Kill()
pTempProcess.Close()
}
2. Windows API.OpenThreadThe OpenThread function opens an existing thread object.
HANDLE OpenThread(
DWORD dwDesiredAccess,
BOOL bInheritHandle,
DWORD dwThreadId
);Parameters
dwDesiredAccess
[in] Access to the thread object. This access right is checked against any security descriptor for the thread. This parameter can be one or more of the thread access rights.
bInheritHandle
[in] If this parameter is TRUE, the new process inherits the handle. If the parameter is FALSE, the handle is not inherited.
dwThreadId
[in] Identifier of the thread to be opened.
Return Values
If the function succeeds, the return value is an open handle to the specified process.If the function fails, the return value is NULL. To get extended error information, call GetLastError.Res
The handle returned by OpenThread can be used in any function that requires a handle to a thread, such as the wait functions, provided you requested the appropriate access rights. The handle is granted access to the thread object only to the extent it was specified in the dwDesiredAccess parameter.When you are finished with the handle, be sure to close it by using the CloseHandle function.