05-03-2010, 03:06 PM
[B]بسم الله لرحمان الرحيم[/B]
السلام عليكم اخوتي
اتقدم لكم بمشروعي البسيط هذا وهو كيفية عمل مصور للشاشة بواسطة الدلفي
كود :
procedure TForm1.Capturer1Click(Sender: TObject);
Var
Bool: Boolean;
touche: Byte;
DesktopHWnd: HWnd;
DesktopDC: HDc;
begin
FormStyle:=fsStayOnTop;
Touche :=VK_SNAPSHOT;
Application.Minimize;
Application.ProcessMessages;
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;
Image1.Picture.Bitmap.Height:=Screen.Height;
BitBlt(Image1.Picture.Bitmap.Canvas.Handle,0,0,
Screen.Width,Screen.Height,GetDC(GetDesktopWindow),0,0,SrcCopy);
ReleaseDC(DesktopHWnd, DesktopDC);
Application.Restore;
form1.BorderStyle:=bsNone;
form1.WindowState:=wsMaximized;
end;