Solved

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

Posted on 2012-03-30
5
2,976 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 37786797
0
 
LVL 101

Expert Comment

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

mlmcc
0
 
LVL 23

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

628 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