TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: BART BROERSMA
date: 1998-02-04 00:26:00
subject: Tasklist in W95/NT, Kill operation

Hi all,
Problem:
In W3.1/D1, to get a tasklist (like pressing Ctrl+Esc.) I use code like:
var
  pTask   : PTaskEntry;
  Task    : Bool;
  S       : String;
begin
  GetMem (pTask, SizeOf (TTaskEntry));
  pTask^.dwSize := SizeOf (TTaskEntry);
  Task := TaskFirst (pTask);
  while Task do
  begin
    S := Format('%.'+IntToStr(Decimals)+'d %s',
                [pTask^.hTask,pTask^.szModule]);
    Memo1.Lines.Add(S);  {Display task in a Memo field...}
    Task := TaskNext (pTask);
  end;
end;
Then, to terminate a (non-responding) application I use
   TerminateApp (pTask^.hTask, NO_UAE_BOX);
How do I go about getting a tasklist (I only need the task's that are 
visable in the W95/NT task-bar, modulename and task-handle would suffice, I 
think) in D2/W95/NT ? (Of course the old D1 code will not compile in D2)
I really need to be able to implement a "Kill" operation on our NT-Server 
(as a last resort, just to be able to shutdown the server properly) and 
running the compiled 16-bit version (D1 example above) only displays 16-bit 
win 3.x tasks...
The help-files were not of much use (only some C code, that I could not 
translate, b.t.w. Why are all the win32 API examples in C ?).
Any help (source) would be much appreciated !
Thanx,
Bart
--------------------------------------
Bart Broersma
broersma@knmg.nl
 * Wave Rider 1.20 [NR] *
... UNREGISTERED EVALUATION COPY
---
---------------
* Origin: * BBS The Final Frontier * 0183-509802 33K6/X.75 * (2:285/334)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.