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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
MadshiCommented:
What error do you get?
And which Delphi version do you have?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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
MadshiCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
traustiAuthor Commented:
I buy hook and sendkeys components from

http://fredsterware.com/delphi.htm

Thanks!!!
0
traustiAuthor Commented:
See ya
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.