X
xiaojun2000
Unregistered / Unconfirmed
GUEST, unregistred user!
以下客户端代码在执行时老是提示超时,为什么呢?
我日前是在本地获取本地的屏幕也会超时????????
procedure TForm3.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
s,s1:string;
desk:tcanvas;
bitmap:tbitmap;
jpg:tjpegimage;
begin
s:=socket.ReceiveText;
if s='gets' then //客户端发出申请
begin
bitmap:=tbitmap.Create;
jpg:=tjpegimage.Create;
desk:=tcanvas.Create; //以下代码为取得当前屏幕图象
desk.Handle:=getdc(hwnd_desktop);
with bitmap do
begin
width:=screen.Width;
height:=screen.Height;
canvas.CopyRect(canvas.cliprect,desk,desk.cliprect);
end;
jpg.Assign(bitmap); //将图象转成JPG格式
jpg.SaveToFile('c:/m.jpg');
jpg.free;
bitmap.Free;
NMStrm1.Host := '6900';
MyFStream := TFileStream.Create('c:/m.jpg', fmOpenRead);
try
serversocket1.Active:=false;
NMStrm1.PostIt(MyFStream);
finally
MyFStream.Free;
end;
serversocket1.Active:=true;
end;
end;
我日前是在本地获取本地的屏幕也会超时????????
procedure TForm3.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
s,s1:string;
desk:tcanvas;
bitmap:tbitmap;
jpg:tjpegimage;
begin
s:=socket.ReceiveText;
if s='gets' then //客户端发出申请
begin
bitmap:=tbitmap.Create;
jpg:=tjpegimage.Create;
desk:=tcanvas.Create; //以下代码为取得当前屏幕图象
desk.Handle:=getdc(hwnd_desktop);
with bitmap do
begin
width:=screen.Width;
height:=screen.Height;
canvas.CopyRect(canvas.cliprect,desk,desk.cliprect);
end;
jpg.Assign(bitmap); //将图象转成JPG格式
jpg.SaveToFile('c:/m.jpg');
jpg.free;
bitmap.Free;
NMStrm1.Host := '6900';
MyFStream := TFileStream.Create('c:/m.jpg', fmOpenRead);
try
serversocket1.Active:=false;
NMStrm1.PostIt(MyFStream);
finally
MyFStream.Free;
end;
serversocket1.Active:=true;
end;
end;