Форум: "WinAPI";
Текущий архив: 2004.05.02;
Скачать: [xml.tar.bz2];
ВнизКак получить список всех окон Windows (включая все дочерние) Найти похожие ветки
← →
Igor5 (2004-03-06 14:48) [0]Wnd := GetWindow(Handle, gw_HWndFirst);
WHILE Wnd <> 0 DO BEGIN
GetClassName(Wnd,Buff,100);
Memo1.Lines.Add(StrPas(buff));
Wnd := GetWindow(Wnd, gw_hWndNext);
end;
показывает не все.
Спасибо за ответ.
← →
Игорь Шевченко © (2004-03-06 19:27) [1]
function EnumChildWindowsProc (WindowHandle : HWND; Data : Pointer) : BOOL; stdcall;
var
WinText : array[0..MAX_PATH] of char;
WinClassName : array[0..MAX_PATH] of char;
Node : TTreeNode;
AImageIndex : Integer;
AIconHandle : THandle;
AIcon : TIcon;
begin
GetWindowText(WindowHandle, WinText, SizeOf(WinText));
GetClassName(WindowHandle, WinClassName, SizeOf(WinClassName));
Node := PWindowTreeNode(Data)^.TreeView.Items.AddChildObject(PWindowTreeNode(Data)^.Node,
Format("%s - %s", [WinClassName, WinText]), Pointer(WindowHandle));
AIconHandle := HSGetWindowIcon(WindowHandle);
if AIconHandle <> 0 then begin
AIcon := TIcon.Create();
AIcon.Handle := CopyIcon(AIconHandle);
AImageIndex := fMain.WindowIconsImageList.AddIcon (AIcon);
if AImageIndex <> -1 then begin
Node.ImageIndex := AImageIndex;
Node.SelectedIndex := AImageIndex;
end;
end else begin
Node.ImageIndex := -1;
Node.SelectedIndex := -1;
end;
Result := true;
end;
function EnumWindowsProc (WindowHandle : HWND; Data : Pointer) : BOOL; stdcall;
var
WinText : array[0..MAX_PATH] of char;
WinClassName : array[0..MAX_PATH] of char;
WindowNode : TWindowTreeNode;
AImageIndex : Integer;
AIconHandle : THandle;
AIcon : TIcon;
begin
GetWindowText(WindowHandle, WinText, SizeOf(WinText));
GetClassName(WindowHandle, WinClassName, SizeOf(WinClassName));
WindowNode.TreeView := TTreeView(Data);
WindowNode.Node := TTreeView(Data).Items.AddObject(nil,
Format("%s - %s", [WinClassName, WinText]), Pointer(WindowHandle));
AIconHandle := HSGetWindowIcon(WindowHandle);
if AIconHandle <> 0 then begin
AIcon := TIcon.Create();
AIcon.Handle := CopyIcon(AIconHandle);
AImageIndex := fMain.WindowIconsImageList.AddIcon (AIcon);
if AImageIndex <> -1 then begin
WindowNode.Node.ImageIndex := AImageIndex;
WindowNode.Node.SelectedIndex := AImageIndex;
end;
end else begin
WindowNode.Node.ImageIndex := -1;
WindowNode.Node.SelectedIndex := -1;
end;
EnumChildWindows(WindowHandle, @EnumChildWindowsProc, LPARAM(@WindowNode));
Result := true;
end;
procedure TfMain.RefreshWindowsView();
begin
WindowsTreeView.Items.Clear();
EnumWindows(@EnumWindowsProc, LPARAM(WindowsTreeView));
end;
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2004.05.02;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.047 c