![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Вопрос по screenshot'ам [D7, WinXP]
Sania © (2006-04-03 12:20:00)<font color="red">HELP!!!</font>
Как снять скриншот, люди говорят, что с помощью Delphi это невозможно? Может есть модули с готовой процедурой??
Sania (2006-04-04 11:35:00) [1]Огромное спасибо!!
Джо (2006-04-03 14:34:00) [2]Вот еще с курсором.
function MakeScreenshot (Bmp: TBitmap; ActiveWindowOnly: Boolean; CaptureCursor: Boolean = True): Boolean;
var
DC: HDC;
ACursor: HICON;
Pt: TPoint;
CurInfo: tagCURSORINFO;
IcoInfo: _ICONINFO;
Wnd: THandle;
ARect: TRect;
begin
Result := False;
if ActiveWindowOnly then
Wnd := GetForegroundWindow
else
Wnd := GetDesktopWindow;
if Wnd = 0 then Exit;
GetWindowRect(Wnd, ARect);
Bmp.Width := ARect.Right - ARect.Left;
Bmp.Height := ARect.Bottom - ARect.Top;
DC := GetWindowDC(Wnd);
try
BitBlt (
Bmp.Canvas.Handle,
0,0,Bmp.Width,Bmp.Height,
DC,
0,0,
SRCCOPY);
// -- курсор
if CaptureCursor then
begin
CurInfo.cbSize := SizeOf(CurInfo);
GetCursorInfo(CurInfo);
ACursor := CurInfo.hCursor;
Pt := CurInfo.ptScreenPos;
GetIconInfo (ACursor,IcoInfo);
DrawIcon(
Bmp.Canvas.Handle,
Pt.X - Integer(IcoInfo.xHotspot),
Pt.Y - Integer(IcoInfo.yHotspot),
ACursor
)
end;
finally
ReleaseDC(Wnd, DC);
end;
Result := True;
end;
balepa (2006-04-03 12:51:00) [3]
> balepa © (03.04.06 12:31) [1]
Добавь.
.........
Canva := TCanvas.Create;
B := TBitmap.Create;
DC := GetDC(0);
JPEG:= TJPEGImage.Create;
......
Palladin (2006-04-03 12:39:00) [4]
> DC := GetDC(0);
рекомендую все таки
DC:=GetDC(GetDesktopWindow);
balepa (2006-04-03 12:37:00) [5]snoup © (08.04.02 20:07)
Пат ну вот например этот код делает рисунок всего экрана:
procedure TForm1.Button2Click(Sender: TObject);
var
Bmp : TBitmap; DC : HDC;
begin Bmp := TBitmap.Create;
Bmp.Height := Screen.Height; Bmp.Width := Screen.Width;
DC := GetDC(0);
BitBlt(Bmp.Canvas.Handle, 0, 0, Screen.Width, Screen.Height,
DC, 0, 0, SRCCOPY);
Bmp.SaveToFile('C:\Windows\Рабочий стол\1.bmp');
ReleaseDC(0, DC);
end;
balepa (2006-04-03 12:31:00) [6]
> Sania (03.04.06 12:20)
> <font color="red">HELP!!!</font>
> Как снять скриншот, люди говорят, что с помощью Delphi это
> невозможно? Может есть модули с готовой процедурой??
Наглая ложь.... Бить их надо
Сам не проверял вот:
Rouse_ © (05.10.02 17:23)
Немного подправлю пример
procedure TForm1.Button1Click(Sender: TObject);
var
DC: HDC;
Canva: TCanvas;
B: TBitmap;
JPEG: TJPEGImage;
Bitmap: TBitmap;
begin
Canva := TCanvas.Create;
B := TBitmap.Create;
DC := GetDC(0);
try
Canva.Handle := DC;
with Screen do
begin
B.Width := Width;
B.Height := Height;
B.Canvas.CopyRect(Rect(0, 0, Width, Height), Canva,Rect(0, 0, Width, Height));
JPEG.Assign(B);
JPEG.SaveToFile('C:\Documents and Settings\Alexander.PENTIUM-200-MMX\Desktop\1.jpg');
end
finally
ReleaseDC(0, DC);
B.Free;
Canva.Free;
JPEG.Free;
end;
Так оно правильней будет
Желаю успехов