Re: Getting a list of open applications (open windows)
- From: erewhon@xxxxxxxxxx (J French)
- Date: Fri, 09 Jun 2006 07:49:57 GMT
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.
.
- Follow-Ups:
- References:
- Getting a list of open applications (open windows)
- From: JamesR
- Getting a list of open applications (open windows)
- Prev by Date: Re: EnumWindowsProc, EnumWindows?
- Next by Date: Re: Possible bug with PChar and string usage, needs confirm (or flame)
- Previous by thread: Getting a list of open applications (open windows)
- Next by thread: Re: Getting a list of open applications (open windows)
- Index(es):