| unitUnit1; interface uses Windows,Messages,SysUtils,Classes, Graphics,Controls,Forms,Dialogs, StdCtrls,FileCtrl,ExtCtrls,Menus; type TForm1=class(TForm) Panel1:TPanel; Panel2:TPanel; FileListBox1:TFileListBox; ListBox1:TListBox; PopupMenu1:TPopupMenu; Hide1:TMenuItem; Show1:TMenuItem; Close1:TMenuItem; procedureFormCreate(Sender:TObject); procedureFileListBox1DblClick(Sender:TObject); procedureHide1Click(Sender:TObject); procedureShow1Click(Sender:TObject); procedureClose1Click(Sender:TObject); private {Privatedeclarations} public {Publicdeclarations} procedureFresh1; end; var Form1:TForm1; implementation {$R*.DFM} functionEnumProc( h:HWND;//handleofchildwindow l:integer//application-definedvalue ):boolean;stdcall; 文章来源于www.hot007.com varbuf:array[0..255]ofchar; begin GetWindowText(h,buf,sizeof(buf)-1); ifiswindowvisible(h)then Form1.ListBox1.items.add ('' strpas(buf) ':' inttostr(h)) else Form1.ListBox1.items.add ('-' strpas(buf) ':' inttostr(h)); Result:=true; end; procedureTForm1.Fresh1; begin ListBox1.clear; enumChildwindows(Panel2.handle, TFNWndEnumProc(@enumproc),0); end; procedureTForm1.FormCreate(Sender:TObject); varbuf:array[0..256]ofchar; begin GetSystemDirectory(buf,sizeof(buf)-1); FileListBox1.directory:=strpas(buf); ListBox1.popupmenu:=Popupmenu1; end; procedureTForm1.FileList Box1DblClick(Sender:TObject); begin WinExec(pchar(FileListBox1.FileName '/p' inttostr(Panel2.handle)), SW_Show); Fresh1; end; procedureTForm1.Hide1Click(Sender:TObject); varh:integer; s:string; begin ifListBox1.itemindex=-1thenexit; s:=Listbox1.items[ListBox1.itemindex]; www.jc567.cn h:=strtoint(copy(s,pos(':',s) 1,length(s))); ShowWindow(h,SW_HIDE); Fresh1; end; procedureTForm1.Show1Click(Sender:TObject); varh:integer; s:string; begin ifListBox1.itemindex=-1thenexit; s:=Listbox1.items[ListBox1.itemindex]; h:=strtoint(copy(s,pos(':',s) 1,length(s))); ShowWindow(h,SW_SHOW); Fresh1; end; procedureTForm1.Close1Click(Sender:TObject); varh:integer; s:string; begin ifListBox1.itemindex=-1thenexit; s:=Listbox1.items[ListBox1.itemindex]; h:=strtoint(copy(s,pos(':',s) 1,length(s))); PostMessage(h,WM_QUIT,0,0); Fresh1; end; end. |