|
Açık Olan Uygulamaları Listeleme
Jul 29,2007 00:00
by
erkan
Güzel Bir Örnek-Açık Olan uygulamaları listelemek... Forma bir ListBox ve Edit ekleyin.
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; ListBox1: TListBox; procedure Button1Click(Sender: TObject); procedure ListBox1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
Function EnumWindowsProc(wHandle: HWND; lb: TListBox): Bool; stdcall; export; var Title, ClassName: array[0..255] of char; PrID : Integer; begin Result := True; GetWindowText(wHandle, Title, 255); GetClassName(wHandle, ClassName, 255); GetWindowThreadProcessId(wHandle, @PrID); if IsWindowVisible(wHandle) then lb.Items.Add(string(Title)); end;
procedure TForm1.Button1Click(Sender: TObject); begin EnumWindows(@EnumWindowsProc, Integer(Listbox1)); end;
procedure TForm1.ListBox1DblClick(Sender: TObject); var selstr:string; begin selstr:=ListBox1.Items[ListBox1.itemindex]; ShowWindow(FindWindow(nil,PChar(selstr)), SW_NORMAL); SetForegroundWindow(FindWindow(nil,PChar(selstr))); end;
end.
|