Solved

Delphi XE2 win32 - List running application like task manager in Windows

Posted on 2012-03-30
5
2,618 Views
Last Modified: 2012-03-30
Hello,

i'm searching a way to get a list of running application in Delphi XE2 win32
I have found a lot of code on the web but all of them are showing how to list "process"

I really need to get the list of running application like the Windows 7 Task manager do on the first Window

Does anyone know how to do?

Thanks for help
0
Comment
Question by:sibliege
5 Comments
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What are you trying to do with this tool?

mlmcc
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
Comment Utility
Windows function EnumWindows is available for this. You have just to use the right parameter to get just the value you need.
Try this code
function EnumWindowsProc(HWND: HWND; List: TStringList): BOOL; stdcall;
var
  s: string;
  IsVisible, IsOwned, IsAppWindow: Boolean;
begin
  Result := True; // carry on enumerating
  IsVisible := IsWindowVisible(HWND);
  if not IsVisible then
    exit;
  IsOwned := GetWindow(HWND, GW_OWNER)<>0;
  if IsOwned then
    exit;
  IsAppWindow := GetWindowLongPtr(HWND, GWL_STYLE) and WS_EX_APPWINDOW<>0;
  if not IsAppWindow then
    exit;
  SetLength(s, GetWindowTextLength(HWND));
  GetWindowText(HWND, PChar(s), Length(s)+1);
  List.Add(s);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Clear;
  EnumWindows(@EnumWindowsProc, lparam(ListBox1.items));
end;

Open in new window

0
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
0
 

Author Closing Comment

by:sibliege
Comment Utility
perfectly what is was searching!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now