JCL Help:TerminateApp

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Terminates the application specified by ProcessID.


Pascal

 function TerminateApp(ProcessID: DWORD; Timeout: Integer): TJclTerminateAppResult;


Parameters

Parameters Description
ProcessID: DWORD Process ID of the application to terminate.
Timeout: Integer Timeout value, in milliseconds, indicating the time to wait between sending the WM_CLOSE message and forcefully terminating the application. You should set this timeout value to at least 5 seconds.


Return Value

If the function succeeds to normally terminate the application (through the WM_CLOSE message) it returns taClean. If the function had to terminate the application by a call to TerminateProcess it returns taKill. If the function fails to terminate the application it returns taError.


Description

Terminates the application specified by ProcessID. The function first attempts to terminate the application normally by sending it a WM_CLOSE message. If the application doesn't terminate itself in response to that message and within the specified timeout period, the function continues to forcefully terminate the application using the TerminateProcess function. In this latter case the application gets no change whatsoever to clean up it's resources and as such this may lead to data loss. Be carefull and very sure there's no other way! The logic used by this function is described in knowledge base article Q178893.


About

Unit

JclSysInfo


Donator

Petr Vones


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page