Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.06.24;
Скачать: CL | DM;

Вниз

Дочерние окна   Найти похожие ветки 

 
ATLANTIDO ©   (2002-04-21 16:48) [0]

Как узнать заголовки или классы всех дочерних окон какого либо окна ?


 
Song ©   (2002-04-21 16:52) [1]

GetWindowName()
GetClassname()


 
ATLANTIDO ©   (2002-04-21 17:06) [2]

Это понятно, а как хэндл получить ?


 
Atrem   (2002-04-21 17:49) [3]

чтобы перебрать все дочерние окна используй EnumChildWindows


 
ATLANTIDO ©   (2002-04-21 18:48) [4]

А как ей пользоваться ?


 
Song ©   (2002-04-21 19:31) [5]

2ATLANTIDO © (21.04.02 18:48)
http://delphi.vitpc.com/helloworld/wininf.htm


 
ATLANTIDO ©   (2002-04-21 23:05) [6]

Воспользовавшись этой статьей написал следующий код:

unit Unit2;
interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
ListBox1: TListBox;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
function EnumProc (Wd: HWnd; Param: LongInt): Boolean; stdcall; // Обязательно stdcall !!!
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

function TForm1.EnumProc (Wd: HWnd; Param: LongInt): Boolean; stdcall; // Обязательно stdcall !!!
var
buffer: array [0..255] of char;
Begin
GetClassName(Wd, buffer, SizeOf(Buffer));
if Buffer<>"" then ListBox1.Items.Add(buffer);
EnumProc := TRUE;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
H : HDC;
begin
H:=GetForegroundWindow;
if H<>0 then
begin
EnumChildWindows(h, @TForm1.EnumProc, 0);
ListBox1.items.Add("----------------");
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.Items.Clear;
end;

end.

В ListBox"e выводятся тоько "-----------";
В чем ошибка ?


 
Song ©   (2002-04-22 08:34) [7]

Я думаю, что h в TTimer.OnTimer дожно быть у Вас равно GetDeskTopWindow


 
Song ©   (2002-04-22 08:37) [8]

Хотя нет. Я понял, что Вы хотите. Вы хотите получть дочерние окна другой программы, а не всех дочерних окон первого уровня.
Попробуйте проверить значение h


 
Atrem   (2002-04-22 12:11) [9]

попробуй такой вариант :


unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
ListBox1: TListBox;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
function MyProc(wnd:hwnd;lparam:longint):boolean;stdcall;
var text:array[0..255] of char;
begin
Result:=true;
if not IsWindow(wnd) then exit;
GetClassName(wnd,text,256);
Form1.ListBox1.Items.Add(text);

end;

procedure TForm1.Timer1Timer(Sender: TObject);
var wnd:HWND;
begin
wnd:=GetForegroundWindow;
if wnd>32 then
begin
ListBox1.Clear;
EnumChildWindows(wnd,@myProc,0);
end;
end;
end.


 
ATLANTIDO ©   (2002-04-23 15:31) [10]

Спасибо, помогло !



Страницы: 1 вся ветка

Текущий архив: 2002.06.24;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.014 c
6-77523
Fellomena
2002-01-08 10:27
2002.06.24
NetShareEnum vs WNetEnumResource and some more... (inside)


7-77636
Ruslan
2002-03-11 16:01
2002.06.24
Работа с com-портом


1-77484
don_dampster
2002-06-12 09:24
2002.06.24
Время


1-77355
hooky-mars
2002-06-10 20:55
2002.06.24
Пмагите найти ошибку! С removedir


4-77684
Ильясов Вадим
2002-04-26 12:04
2002.06.24
Регулировка звука