никак не получается разобраться.
знаю что тема поднималась кучу раз, но все же.
получаю список приложений в ListBox'е по кнопке.
можно ли мне как-то снять задачу в нем?
или нужно через StringGrid?
не знаю как перейти от Листбокса к СтрингГриду.
И не совсем догоняю как получить хэндлы всех процессов.
кто-нибудь может помочь чайнику...
читать дальшеunit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ComCtrls, Grids;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
appsheet: TTabSheet;
processheet: TTabSheet;
spaadsheet: TTabSheet;
processlist: TStringGrid;
Button2: TButton;
Button3: TButton;
Button4: TButton;
ListBox1: TListBox;
Button1: TButton;
Button5: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Wnd: hWnd;
buff: array[0..127] of Char;
begin
ListBox1.Clear;
Wnd := GetWindow(Handle, gw_HWndFirst);
while Wnd <> 0 do begin {Не показываем:}
if (Wnd <> Application.Handle) and {-Собственное окно}
IsWindowVisible(Wnd) and {-Невидимые окна}
(GetWindow(Wnd, gw_Owner) = 0) and {-Дочернии окна}
(GetWindowText(Wnd, buff, sizeof(buff)) <> 0) {-Окна без заголовков}
then begin
GetWindowText(Wnd, buff, sizeof(buff));
ListBox1.Items.Add(StrPas(buff));
end;
Wnd := GetWindow(Wnd, gw_hWndNext);
end;
ListBox1.ItemIndex := 0;
end;
end.