Find All Runnung App ( TWindow.text )

How can i find all running application , windows name
e.g caption of the window of all running application and put it in listbox1?
traustiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MadshiConnect With a Mentor Commented:
nrico, that's right. But this way you only get the window captions of all windows system wide. That means, for most programs you'll get more than one window, and for some programs you get nothing at all. With my sources you get exactly one window for each program, or (if the program has no window at all) the filename of the executable.

trausti, do you mean me with the answer? Were you able to make it work? What was the problem?

You can accept any comment as the answer by clicking on "accept as answer" in the right top of the comment window.

Regards, Madshi.
0
 
MadshiCommented:
If you've D4 or D5, you can find all that you need in the free unit "enumStuff.pas", which you can download from my homepage:

http://beam.to/madshi

Regards, Madshi.
0
 
traustiAuthor Commented:
I get an error on

( function GetWindowList (pid: cardinal = 0; tid: cardinal = 0; onlyThoseInTaskbar: boolean = false) : TWindowList;)

TWindowList; = Error

Get you give me code for button1.click and add all the windows in listbox?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
MadshiCommented:
What error do you get?
And which Delphi version do you have?
0
 
traustiAuthor Commented:
I use Delphi 4, undeclared indentifier
0
 
MadshiCommented:
Something like this (not tested):

uses [...], enumStuff;

procedure TForm1.Button1Click(Sender: TObject);
var pl : TProcessList;
    i1 : integer;
begin
  pl := GetProcessList;
  for i1 := 0 to high(pl) do
    listBox1.Add(pl[i1].name);
end;

Regards, Madshi.
0
 
traustiAuthor Commented:
I want windowname like in macro magic

e.g Untitled - Notepad
0
 
MadshiCommented:
Something like this?

procedure TForm1.Button1Click(Sender: TObject);
var pl : TProcessList;
    wl : TWindowList;
    i1 : integer;
begin
  pl := GetProcessList;
  for i1 := 0 to high(pl) do begin
    wl := GetWindowList(pl[i1].pid, 0, true);
    if (wl <> nil) and (wl[0].title <> '') then
         listBox1.Add(wl[0].title)
    else listBox1.Add(pl[i1].name);
end;
0
 
traustiAuthor Commented:
I get an error on TProcessList,TWindowsList

My Delphi did not understand that class
0
 
MadshiCommented:
Have you installed the latest update packs (2 and 3)?
0
 
MadshiCommented:
And have you added "enumStuff" to the uses clause of your unit?
0
 
nricoCommented:
You can also simply use EnumWindows and write a callback yourself (See your Win32 API documentation).
Unfortunately, I don't have the code to demonstrate currently...

(P.S: You'll find out there are a whole lot more windows than you think!! ;-)
0
 
traustiAuthor Commented:
I can't give you answer - mark your comments as answer -
0
 
traustiAuthor Commented:
I buy hook and sendkeys components from

http://fredsterware.com/delphi.htm

Thanks!!!
0
 
traustiAuthor Commented:
See ya
0
All Courses

From novice to tech pro — start learning today.