Link to home
Start Free TrialLog in
Avatar of karen021897
karen021897

asked on

get all windows caption list


- how can i get into string array all windows caption list

e.g

i have 'notepad' , 'delphi 4' , 'calculator' opens on my computer
and i want to get the window title into string array e.g
'Untitled - Notepad'

Thanks
Karen
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DrDelphi
DrDelphi

a little less top heavy(taken straight from my website):


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}

function EnumWindowsCallBack(HWND: hwnd;LPARAM : lParam):bool stdcall;
  var
  capt:array[0..79] of char;
  ClassName:array[0..79] of char;
 begin
                result:=true;
                GetWindowText( HWND, capt, 79);
                GetClassName(HWND,ClassName,79);  if length(capt) > 0 then
                Form1.Listbox1.items.add(capt+' ... '+Classname);
 end;
procedure TForm1.Button1Click(Sender: TObject);
     begin
     Listbox1.Items.clear;
  EnumWindows(@EnumWindowsCallBack, 0)
  ;end;
end.


Good luck!!
Avatar of karen021897

ASKER

You are the man!!!

Thanks
Karen