Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#13

Re: anderes Programm "sanft" beenden

  Alt 3. Dez 2004, 18:51
Doch wird er.
Zitat:
Remarks
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.

TerminateProcess initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.

Terminating a process causes the following:


All object handles opened by the process are closed.
All threads in the process terminate their execution. Each thread exits when all its pending I/O has been completed or canceled. The process exits after all its threads exit.
The state of the process object becomes signaled, satisfying any threads that had been waiting for the process to terminate. The process object is deleted when the last handle to the process is closed.
The states of all threads of the process become signaled, satisfying any threads that had been waiting for the threads to terminate.
The termination status of the process changes from STILL_ACTIVE to the exit value of the process.
Nur das ist zu beachten:
Zitat:
DLLs attached to the process are not notified that the process is terminating.
Das heißt: Läd dein Prozess eine DLL wird der Referenzcounter der DLL nicht zurück gesetzt. Hat noch ein weitere Prozess die DLL geladen und wird normal beendet und dein Prozess wird abgeschossen, wird die DLL nicht entladen, da der ReferenzCount noch bei 1 ist.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat