Re: Getting a list of open applications (open windows)
- From: "JamesR" <wizzer90@xxxxxxxxxxx>
- Date: 9 Jun 2006 02:28:25 -0700
I'm wanting to know get a list of all the open Windows (any window with
a button on the Task Bar). The same list that appears when you open the
Task Manager under the 'Application' tab.
So I see your method lists all running exes, including systray and
Windows services etc.
...I thought I would post twice btw because the subject of the other
message might have been a little unclear..
J French wrote:
On 8 Jun 2006 13:50:36 -0700, "JamesR" <wizzer90@xxxxxxxxxxx> wrote:
The task manager (ctrl+alt+del) shows a list of applications open. This
seems to be any application open on the task bar, because if you
minimize an application to the system tray, it is no longer show in the
task manager 'application' tab. Well i'm just wondering how I can get a
list of the running applications in the same way - the ones open on the
task bar.
I have looked into EnumWindows, but I can only seem to get hold of a
full list of processes running on the machine, and i'm not sure how to
narrow this down / sort into just the open applications (open visible
windows).
Having looked at your other post on the subject, I'm not at all sure
that I know what you really want
There is a difference between a Process and a Window
Maybe this is what you are really after, maybe not ....
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Uses TlHelp32;
procedure TForm1.Button1Click(Sender: TObject);
Var
recPROCESSENTRY32 :PROCESSENTRY32;
hndSnapShot :DWORD;
S :String;
Res :Boolean;
begin
ListBox1.Clear;
hndSnapShot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
If hndSnapShot <> 0 Then
Begin
recPROCESSENTRY32.dwSize := SizeOf(recPROCESSENTRY32);
Res := Process32First(hndSnapShot, recPROCESSENTRY32);
While Res <> False Do
Begin
S := recPROCESSENTRY32.szExeFile;
ListBox1.Items.Add( S );
Res := Process32Next(hndSnapShot, recPROCESSENTRY32);
End;
CloseHandle( hndSnapShot );
End;
End;
end.
.
- References:
- Getting a list of open applications (open windows)
- From: JamesR
- Re: Getting a list of open applications (open windows)
- From: J French
- Getting a list of open applications (open windows)
- Prev by Date: Re: EnumWindowsProc, EnumWindows?
- Next by Date: Re: EnumWindowsProc, EnumWindows?
- Previous by thread: Re: Getting a list of open applications (open windows)
- Index(es):