Link to home
Start Free TrialLog in
Avatar of Stuart_Johnson
Stuart_Johnson

asked on

Active Task List

How do I retrieve a list of all running tasks within Windows (like the task manager?).

Stu
ASKER CERTIFIED SOLUTION
Avatar of inter
inter
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stuart_Johnson
Stuart_Johnson

ASKER

inter:

Thanks for the post, however when we tried it we continually got protection errors.  

I had to change the StringList to a TStrings type.  That fixed the protection fault, but there is a problem when we are converting the WN array to the string.  Although the array contains information, it is not being converted to a string.  It is as though there is nothing in the array.  Wierd, eh?

Any suggestions?

Stuart.
Hi, sorry but the code works without modification. Just add a list box and a button to an empty form, copy and paste the code after implenetation clause and run. I am using Delphi 2.0. If you want I can send you the whole project and/or exe so that we can see if there is something with your windows.
About WN: (Examine my explanation below)

if GetWindowText(hwnd, wn,sizeof(wn)) <> 0 then //If windows has caption proceed
begin
    w:= Format('%6d ',[pid])+StrPas(wn); //StrPas routine converts the null terminated.
    S.Add...//add it to the list
end;
Friend, if this simple code does not works this should be do to some other thing which I can not understand by now.
Regards, Igor
Igor,

I humbly appologise for that.  I just took the word of someone else (granted I over looked it too).  Seems we made the mistake.


Thank you for your help!


Stuart.
You are wellcome, thanks!