Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About the window handle

Status
Not open for further replies.

MirceaVleju

Programmer
Oct 10, 2003
32
0
0
RO
How do i get the handles of all the windows that are running at a given time ?
 
Do you mean all aplications or all processes?

For all applications I did it like this:

function EnumWindowsProc(Handle: HWND;param: LPARAM): LongBool; stdcall;
var Buffer: array[0..1024] of Char;
begin
Result:=True;
if GetWindowLong(Handle,GWL_STYLE) AND WS_VISIBLE=0 then Exit;
GetWindowText(Handle,Buffer,SizeOf(Buffer));
if not (Buffer[0] = #0) then
Form1.ListBox1.Items.AddObject(Buffer,TObject(Handle));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
EnumWindows(@EnumWindowsProc,0)
end;

All Applicationwindows are being presented in Listbox1.
(Mind the wordwrapping on this forum)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top