HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE, entry.dwPID);
if ( hProcess )
{
CloseHandle( hProcess );
}上一段是我写的部分DLL代码,意在关闭进程,其中entry.dwPID是通过列举进程得到的,可是上面的代码没有用,不能关闭进程!不知道为什么!

解决方案 »

  1.   

    BOOL TerminateProcess(
      HANDLE hProcess, // handle to the process
      UINT uExitCode   // exit code for the process
    );
    或者
    VOID ExitProcess(
      UINT uExitCode   // exit code for all threads
    );
     
    Parameters
    uExitCode 
    Specifies the exit code for the process, and for all threads that are terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value