Einzelnen Beitrag anzeigen

luckys41

Registriert seit: 9. Feb 2009
20 Beiträge
 
#4

Re: Bild senden Fehler

  Alt 12. Mär 2009, 15:25
So hab es mal ein bisschen verändert und es kommt der gleiche Fehler immer noch :

Client :
Delphi-Quellcode:

procedure TForm1.FormCreate(Sender: TObject);
begin
Stream:=TMemorystream.Create;
end;
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
  var BufSize: Integer;
  s: String;
begin
Bufsize:=serversocket1.Socket.receivelength;
stream.size:=bufsize;
serversocket1.Socket.ReceiveBuf(stream,BufSize);
form4.image1.picture.bitmap.loadfromstream(stream);
stream.free;
end;
Server :
Delphi-Quellcode:
dc := GetDc(GetDesktopWindow);
  Image1 := Timage.Create(self);
  Image1.Width := GetDeviceCaps(dc,HORZRES);
  Image1.Height := GetDeviceCaps(dc,VERTRES);
  BitBlt(Image1.Canvas.Handle,0,0,Image1.Width,Image1.Height,dc,0,0,SRCCOPY);
  Image1.Canvas.Brush.Style := bsClear;
  Image1.Canvas.Font.Color := clred;
  jpeg := TJPEGImage.Create;
  jpeg.Assign(Image1.Picture.Bitmap);
Stream:=TMemoryStream.Create;
ssize:=stream.size;
Image1.Picture.Bitmap.SaveToStream(Stream);
Stream.Position:=0;
ClientSocket1.Socket.SendBuf(ssize, SizeOf(ssize));
clientsocket1.socket.sendstream(Stream);
  ReleaseDc(GetDesktopWindow,dc);
  Image1.Free;
  jpeg.Free;
  end;
  Mit Zitat antworten Zitat