Кто чем сможет, буду рад!
Памагыте
Code: Select all
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DwmApi, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
CheckBox1: TCheckBox;
Panel1: TPanel;
ComboBox1: TComboBox;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Procedure EnumWindowsProc;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.EnumWindowsProc;
var
Wnd : hWnd;
buff : array [0..127] of Char;
wclass : string;
begin
Wnd := GetWindow(Handle, gw_HWndFirst);
while Wnd <> 0 do
begin
setLength(wclass,12);
GetClassName(wnd,@wclass[1],Length(wclass)+1);
if (Wnd <> Application.Handle) and IsWindowVisible(Wnd) and
(GetWindowText(Wnd, buff, sizeof(buff)) <> 0) and (wclass<>'TApplication')
then
begin
GetWindowText(Wnd, buff, sizeof(buff));
//str :=StrPas(buff);
ComboBox1.Items.Add(StrPas(buff));
// form1.wndBox.Items.Add(StrPas(buff));
end;
Wnd := GetWindow(Wnd, gw_hWndNext);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
EnumWindowsProc;
end;
procedure TForm1.Button1Click(Sender: TObject);
var PH: PHTHUMBNAIL;
Props: DWM_THUMBNAIL_PROPERTIES;
ProgmanHandle: THandle;
begin
ProgmanHandle := 0;
if ComboBox1.Text > '' then
ProgmanHandle := FindWindow(nil, PChar(ComboBox1.Text))
else
ShowMessage('Nothing checked!');
if ProgmanHandle > 0 then
begin
if Succeeded(DwmRegisterThumbnail(Handle,ProgmanHandle,PH))then
begin
Props.dwFlags:=DWM_TNP_SOURCECLIENTAREAONLY or DWM_TNP_VISIBLE or
DWM_TNP_OPACITY or DWM_TNP_RECTDESTINATION;
Props.fSourceClientAreaOnly:=false;
Props.fVisible:=true;
Props.opacity:=255;
Props.rcDestination:=Form1.Panel1.ClientRect;
if Succeeded(DwmUpdateThumbnailProperties(PH^,Props))then
//ShowMessage('Thumbnail готов')
else
ShowMessage('DwmUpdateThumbnailProperties false');
end
else
begin
ShowMessage('DwmRegisterThumbnail False ');
end;
end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
Form1.FormStyle := fsStayOnTop;
end;
end.