Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#7

AW: FindWindow findet Fenster nicht

  Alt 1. Mai 2012, 10:22
IE mit Google ist bei mir in der Liste ....

Delphi-Quellcode:
function EnumWindowsProc1(Wnd: HWND; LB:TListBox): BOOL; stdcall;
const
  MyMaxName = 255;
  MyMaxText = 255;
var
  ClassName: String;
  WindowText: String;
begin
  Result := True;
  SetLength(ClassName, MyMaxName);
  SetLength(ClassName,GetClassName(Wnd, PChar(ClassName), MyMaxName));
  SetLength(WindowText, MyMaxText);
  SetLength(WindowText,GetWindowText(Wnd,PChar(WindowText),MyMaxText));
  LB.Items.AddObject('[' + ClassName + '] "' + WindowText + '"' + ' Handle: ' + IntToStr(Wnd), Pointer(Wnd));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Treeview1.Items.Clear;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Treeview1.Items.Clear;
  Listbox1.Items.Clear;
  Listbox1.Items.BeginUpdate;
  EnumWindows(@EnumWindowsProc1, Integer(TObject(ListBox1)));
  Listbox1.Items.EndUpdate;
  Listbox1.Sorted := true;
end;
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat