高手帮帮忙...网上相关说明真看得含糊!!! 现在程序想把一个Tbitmap类型的图片文件变量   aaa发送到目标机   使用idtcpclient发送应该怎么操作呢?代码怎么写呢!!! 给我直接的代码好吗   我不要告诉我怎么做怎么做.我看得含糊!!! 发送了   对方使用idtcpserver怎么把接收到的显示到image上呢? 绝对送分的 下面是源码部分!!!var
  Fullscreen:Tbitmap;
  FullscreenCanvas:TCanvas;
  dc:HDC;
begin
  Fullscreen:=TBitmap.Create;
  Fullscreen.Width:=screen.width;
  Fullscreen.Height:=screen.Height;
  DC:=GetDC(0); 
  FullscreenCanvas:=TCanvas.Create; 
  FullscreenCanvas.Handle:=DC;
  Fullscreen.Canvas.CopyRect(Rect(0,0,screen.Width,screen.Height),fullscreenCanvas,Rect(0,0,Screen.Width,Screen.Height));//把整个屏幕复制到BITMAP中 
  FullscreenCanvas.Free;
  ReleaseDC(0,DC);  
  //这里已经得到了需要的图片!!! fullscreen 变量!!
try
  if idtcpclient1.Connected=false then
     idtcpclient1.Connect;
  idtcpclient1.Writeln('我上线了');
  IdTCPClient1.Connect(5000);
  IdTCPClient1.    //这里怎么把这个fullscreen 变量的图片发送出去
  idtcpclient1.Disconnect;
 except
  timer1.Enabled:=true;
 end;end;

解决方案 »

  1.   


    var
    fStream : TFileStream;
        //Save
        FullscreenCanvas.SaveToFile(ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP');
        FullscreenCanvas.FreeImage;
        FreeAndNil(FullscreenCanvas);    // open file stream to image requested
        fStream := TFileStream.Create(ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP',fmOpenRead + fmShareDenyNone);
        // copy file stream to write stream
        AThread.Connection.OpenWriteBuffer;
        AThread.Connection.WriteStream(fStream);
        AThread.Connection.CloseWriteBuffer;
        // free the file stream
        FreeAndNil(fStream);
      

  2.   

    http://topic.csdn.net/u/20080220/15/1c9615a4-b8eb-4c44-860b-97267c43fa0f.html这个贴是什么意思?什么叫无满意答案结贴,白白浪费时间给你写了代码
      

  3.   


    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, ExtCtrls, IdTCPServer, IdBaseComponent,
      IdComponent, jpeg, IdTCPConnection, IdTCPClient;type
      TForm1 = class(TForm)
        Image1: TImage;
        BitBtn1: TBitBtn;
        IdTCPClient1: TIdTCPClient;
        Timer1: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
    implementation{$R *.dfm}
    procedure TForm1.FormCreate(Sender: TObject);
    var
      Fullscreen:Tbitmap;
      FullscreenCanvas:TCanvas;
      dc:HDC;
    begin
      Fullscreen:=TBitmap.Create;
      Fullscreen.Width:=screen.width;
      Fullscreen.Height:=screen.Height;
      DC:=GetDC(0); 
      FullscreenCanvas:=TCanvas.Create; 
      FullscreenCanvas.Handle:=DC;
      Fullscreen.Canvas.CopyRect(Rect(0,0,screen.Width,screen.Height),fullscreenCanvas,Rect(0,0,Screen.Width,Screen.Height));//把整个屏幕复制到BITMAP中 
      FullscreenCanvas.Free;
      ReleaseDC(0,DC);  
      //这里已经得到了需要的图片!!! fullscreen 变量!!
    try
      if idtcpclient1.Connected=false then
         idtcpclient1.Connect;
      idtcpclient1.Writeln('我上线了');
      IdTCPClient1.    {这里怎么把这个fullscreen 图片变量发送到服务器呢 服务器又怎么收呢}
      idtcpclient1.Disconnect;
     except
      timer1.Enabled:=true;
     end;end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    try
      if not idtcpclient1.Connected then
         idtcpclient1.Connect;
      timer1.Enabled:=false;
    except
    end;
    end;end.
      

  4.   

    最后一次回贴,请看INDY的HELP