Link to home
Start Free TrialLog in
Avatar of fischermx
fischermxFlag for Mexico

asked on

How do I get a list of the applications in the taskbar?

I wrote a little piece of code in Delphi that retrieves me the list of all the windows running at a time (using EnumWindows).
The problem I have is that seems to list about every little window running, even those inside the applications.
I think I should go other route, since this EnumWindows gets windows, not applications running.

What should I use else?
Avatar of ThievingSix
ThievingSix
Flag of United States of America image

Do you want to get all the processes like the task manager processes tab? If so: http://www.swissdelphicenter.ch/torry/showcode.php?id=616
Avatar of fischermx

ASKER

Nope, I want the applications in the task bar.
ASKER CERTIFIED SOLUTION
Avatar of KillerCode
KillerCode
Flag of Egypt 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

Great!, The "IsWindowVisible" is what I was looking for.
That did it!! Thank you very much.

Can I ask something more...... how do I get which is the Active window?
I see that in the list of applications filled by EnumWindows the first one seems to be the active one, but I'm not sure if this if I can take this as granted.
Easy too, just use GetForegroundWindow and then Get the Text from this handle
function ActiveWindow:string;
var
 Handle: THandle;
 Len: LongInt;
 Title: string;
begin
 Handle := GetForegroundWindow;
 Len := GetWindowTextLength(Handle) + 1;
 SetLength(Title, Len);
 GetWindowText(Handle, PChar(Title), Len);
 ActiveWindow := Trim(Title);
end;

Open in new window

Thank you!!
Thank you!!