S
sbzldlb
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TScreenClientThread.GetScreen(var Bmp: TBitmap; ScreenWidth,ScreenHeight:Integer);
var
ScreenDC: HDC;
begin
ScreenDC:=GetDC(0);
try
Bmp.PixelFormat := pf8bit;
Bmp.Width := ScreenWidth;
Bmp.Height := ScreenHeight;
BitBlt(Bmp.Canvas.Handle ,0,0,ScreenWidth,ScreenHeight,ScreenDC,0,0,SRCCOPY);
form1.Image1.Canvas.Draw(0,0,Bmp);
finally
ReleaseDC(0,ScreenDC);
end;
end;
这个可以截图,但是程序会卡,在线程中
while not self.Terminated do
begin
//FAviBmp:=TBitmap.Create;
try
//FAviBmp.Canvas.Assign(NIl);
GetScreen(FAviBmp,FScreenWidth,FScreenHeight);
//FScreenAvi.Add(FAviBmp);
//Sleep(Round(1000/12));
finally
//FAviBmp.Free;
end;
end;
如果 FAviBmp 在得到图片之前,不重新创建,会截不到图片
不知道什么原因
不知道还有什么别的好点的方法
var
ScreenDC: HDC;
begin
ScreenDC:=GetDC(0);
try
Bmp.PixelFormat := pf8bit;
Bmp.Width := ScreenWidth;
Bmp.Height := ScreenHeight;
BitBlt(Bmp.Canvas.Handle ,0,0,ScreenWidth,ScreenHeight,ScreenDC,0,0,SRCCOPY);
form1.Image1.Canvas.Draw(0,0,Bmp);
finally
ReleaseDC(0,ScreenDC);
end;
end;
这个可以截图,但是程序会卡,在线程中
while not self.Terminated do
begin
//FAviBmp:=TBitmap.Create;
try
//FAviBmp.Canvas.Assign(NIl);
GetScreen(FAviBmp,FScreenWidth,FScreenHeight);
//FScreenAvi.Add(FAviBmp);
//Sleep(Round(1000/12));
finally
//FAviBmp.Free;
end;
end;
如果 FAviBmp 在得到图片之前,不重新创建,会截不到图片
不知道什么原因
不知道还有什么别的好点的方法