T
tswhq
Unregistered / Unconfirmed
GUEST, unregistred user!
constructor TDesk.Create(R:TRect;SSeat:ScreenSeat);
begin
LRect:=R;
LBmp:=TBitMap.Create ;
LJpg:=TJpegImage.Create;
NowDesk:=TMemoryStream.Create ;
SendDesk:=TMemoryStream.Create ;
T:=TCanvas.Create ;
D:=GetDC(0);
LBmp.Width :=LRect.Right-LRect.Left+1;
LBmp.Height :=LRect.Bottom-LRect.Top+1;
Seat:=SSeat;
inherited Create(False);
FreeOnTerminate:=True;
end;
procedure TDesk.Execute;
begin
inherited;
repeat
T.Handle:=D;
T.Lock;
LBmp.Canvas.CopyRect(Rect(0,0,LBmp.Width,LBmp.Height),T,LRect);
T.Unlock;
LJpg.Assign(LBmp);
Ljpg.JPEGNeeded ;
LJpg.CompressionQuality :=50;
LJpg.Compress;
LJpg.SaveToStream(NowDesk);
NowDesk.Position :=0;
SendDesk.WriteBuffer(Seat,SizeOf(Seat));
SendDesk.CopyFrom(NowDesk,NowDesk.Size);
Form1.TransferCtrl.SendBuffer(CtrlInfo.ReceIp,CtrlInfo.RecePort,SendDesk.Memory^,SendDesk.Size);//Udp发送数据
SendDesk.Clear;
NowDesk.Clear ;
Until terminated;
T.Free ;
ReleaseDc(0,D);
LBmp.Free ;
LJpg.Free ;
SendDesk.Free ;
NowDesk.Free ;
end;
创建线程
ScreenGridProcess(CtrlInfo.ScreenW,CtrlInfo.ScreenH);//将桌面分成4块传送
Desk[0]:=TDesk.Create(SGrid[0],L1);//左一
Desk[1]:=TDesk.Create(SGrid[1],M1);//中一
Desk[2]:=TDesk.Create(SGrid[2],M2);//中二
Desk[3]:=TDesk.Create(SGrid[3],R1);//右一
为何运行一段时间后报错:Out of System Resource
begin
LRect:=R;
LBmp:=TBitMap.Create ;
LJpg:=TJpegImage.Create;
NowDesk:=TMemoryStream.Create ;
SendDesk:=TMemoryStream.Create ;
T:=TCanvas.Create ;
D:=GetDC(0);
LBmp.Width :=LRect.Right-LRect.Left+1;
LBmp.Height :=LRect.Bottom-LRect.Top+1;
Seat:=SSeat;
inherited Create(False);
FreeOnTerminate:=True;
end;
procedure TDesk.Execute;
begin
inherited;
repeat
T.Handle:=D;
T.Lock;
LBmp.Canvas.CopyRect(Rect(0,0,LBmp.Width,LBmp.Height),T,LRect);
T.Unlock;
LJpg.Assign(LBmp);
Ljpg.JPEGNeeded ;
LJpg.CompressionQuality :=50;
LJpg.Compress;
LJpg.SaveToStream(NowDesk);
NowDesk.Position :=0;
SendDesk.WriteBuffer(Seat,SizeOf(Seat));
SendDesk.CopyFrom(NowDesk,NowDesk.Size);
Form1.TransferCtrl.SendBuffer(CtrlInfo.ReceIp,CtrlInfo.RecePort,SendDesk.Memory^,SendDesk.Size);//Udp发送数据
SendDesk.Clear;
NowDesk.Clear ;
Until terminated;
T.Free ;
ReleaseDc(0,D);
LBmp.Free ;
LJpg.Free ;
SendDesk.Free ;
NowDesk.Free ;
end;
创建线程
ScreenGridProcess(CtrlInfo.ScreenW,CtrlInfo.ScreenH);//将桌面分成4块传送
Desk[0]:=TDesk.Create(SGrid[0],L1);//左一
Desk[1]:=TDesk.Create(SGrid[1],M1);//中一
Desk[2]:=TDesk.Create(SGrid[2],M2);//中二
Desk[3]:=TDesk.Create(SGrid[3],R1);//右一
为何运行一段时间后报错:Out of System Resource