home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
vrac
/
del2faq.zip
/
TI2856.ZIP
/
TI2856.ASC
Wrap
Text File
|
1996-02-28
|
1KB
|
43 lines
NUMBER : 2856
PRODUCT : Delphi
VERSION : 1.0
OS : Windows
DATE : February 28, 1996
TITLE : How to terminate all running applications
Q: How do I terminate all running tasks?
A: Below is some code that will help if you want to terminate ALL tasks,
no questions asked.
A word of caution, before you run this for the first time, make sure
that you save it and anything else that may have some pending data.
procedure TForm1.ButtonKillAllClick(Sender: TObject);
var
pTask : PTaskEntry;
Task : Bool;
ThisTask: THANDLE;
begin
GetMem (pTask, SizeOf (TTaskEntry));
pTask^.dwSize := SizeOf (TTaskEntry);
Task := TaskFirst (pTask);
while Task do
begin
if pTask^.hInst = hInstance then
ThisTask := pTask^.hTask
else
TerminateApp (pTask^.hTask, NO_UAE_BOX);
Task := TaskNext (pTask);
end;
TerminateApp (ThisTask, NO_UAE_BOX);
end;
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.