Solved

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

Posted on 2012-03-30
5
2,678 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
ID: 37786797
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37786913
What are you trying to do with this tool?

mlmcc
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 37787016
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
ID: 37787055
0
 

Author Closing Comment

by:sibliege
ID: 37787137
perfectly what is was searching!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

911 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

21 Experts available now in Live!

Get 1:1 Help Now