Solved

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

Posted on 2012-03-30
5
2,832 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

756 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