procedure
TForm1.Button1Click(Sender: TObject);
Var Bool: Boolean;
touche: Byte;
DesktopHWnd: HWnd;
DesktopDC: HDc;
begin
Touche := VK_F12;//Touche F12
Application.Minimize; //Réduit
l'application
Application.ProcessMessages; //Traite
la file d'attente des messages
Bool := (GetAsyncKeyState(Touche) and 1 = 1);
Repeat Application.ProcessMessages;
Bool := (GetAsyncKeyState(Touche) and 1 = 1);
Until Bool or Application.Active;
If Bool then Begin
DesktopHWnd := GetDesktopWindow;
DesktopDC := GetDC(DesktopHWnd);
Image1.Picture.Bitmap.Width:=Screen.Width; //Largeur
de l'écran
Image1.Picture.Bitmap.Height:=Screen.Height; //Hauteur
de l'écran
BitBlt(Image1.Picture.Bitmap.Canvas.Handle,0,0,
Screen.Width,Screen.Height,GetDC(GetDesktopWindow),0,0,SrcCopy);
ReleaseDC(DesktopHWnd, DesktopDC);
Application.Restore; //Restaure
à sa taille l'application
end;
end;
|