title: How to permanently terminate Windows Explorer (the "explorer.exe" process)?
body: <p>I'm using the following code to terminate a process:</p>
  
  <pre><code>function KillTask(ExeFileName: string): Integer;
  const
    PROCESS_TERMINATE = $0001;
  var
    ContinueLoop: BOOL;
    FSnapshotHandle: THandle;
    FProcessEntry32: TProcessEntry32;
  begin
    Result := 0;
    FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
    ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  
    while Integer(ContinueLoop) &lt;&gt; 0 do
    begin
      if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
        UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
        UpperCase(ExeFileName))) then
        Result := Integer(TerminateProcess(
                      OpenProcess(PROCESS_TERMINATE,
                                  BOOL(0),
                                  FProcessEntry32.th32ProcessID),
                                  0));
      ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
    end;
    CloseHandle(FSnapshotHandle);
  end;
  </code></pre>
  
  <p>The problem is, when I call the above function in order to permanently terminate the <code>explorer.exe</code>, the Windows Explorer terminates though, but it's re-started afterwards:</p>
  
  <pre><code>KillTask('explorer.exe');
  </code></pre>
  
  <p>I'm using Delphi XE3, Delphi 7 and Windows 8.</p>