procedure TForm1.Button4Click(Sender: TObject); var h: HWnd; p: array[0..254] of char; begin h := GetWindow(Handle, GW_HWNDFIRST); while h <> 0 do begin if GetWindowText(h, p, 255) > 0 then listbox1.items.Add(p); h := GetWindow(h, GW_HWNDNEXT); end;
end; procedure TForm1.FormCreate(Sender: TObject); var h: HWnd; p: array[0..254] of char; begin h := GetWindow(Handle, GW_HWNDFIRST); while h <> 0 do begin if GetWindowText(h, p, 255) > 0 then listbox1.items.Add(p); h := GetWindow(h, GW_HWNDNEXT); end;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject); var i:Integer; begin for i :=0 to ListBox1.Count-1 do begin if ListBox1.Selected[i] then edit1.Text:=(ListBox1.Items.Strings[i]); end; end;
procedure TForm1.Button5Click(Sender: TObject); begin SetWindowPos(Handle, HWND_TOPMOST, 200,200, 500,500, SWP_SHOWWINDOW); end;
procedure TForm1.Button6Click(Sender: TObject); var fh:hwnd; begin fh:=findwindow(nil,pchar(edit1.Text)); printWindow(fh,image1.Canvas.Handle ,0); //窗口显示,没有最小化和隐藏都可以抓到 //比如 把画图窗口 移出屏幕范围,,也能抓到,, form1.Repaint ; end;