🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4984

Re: IdTCPServer & Image (Synchronize)

#4984
From: Willie
Date: Mon, 08 Nov 2004 17:52
89 lines
3253 bytes
Hello Remy:

Yes! Your code is working very fine now!
Thank you very very very....much.

Willie.

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> ���g��l��s�D
:418f3099$1@newsgroups.borland.com...
>
> "Willie" <Willie.nospam@nospam.pchome.com.tw> wrote in message
> news:418f1c70$1@newsgroups.borland.com...
>
> > How can I update my Image?
> <snip>
> > How can I modify the code to work fine?
>
> Try something like this code:
>
>     class TUpdateImage : public TIdSync
>     {
>     private:
>         TPicture* FPicture;
>         TJPEGImage* FJpg;
>     protected:
>         __fastcall TUpdateImage(TIdPeerThread* AThread, TStream*
ASrcStream,
> TPicture* ADestPicture);
>         void __fastcall DoSynchronize();
>     public:
>         __fastcall ~TUpdateImage();
>         static void __fastcall Update(TIdPeerThread* AThread, TPicture*
> APicture);
>     };
>
>     __fastcall TUpdateImage::TUpdateImage(TIdPeerThread* AThread, TStream*
> ASrcStream, TPicture* ADestPicture)
>         : TIdSync(AThread), FPicture(ADestPicture)
>     {
>         FJpg = new TJPEGImage;
>         FJpg->LoadFromStream(ASrcStream);
>         FJpg->CompressionQuality = 100;
>     }
>
>     __fastcall TUpdateImage::~TUpdateImage()
>     {
>         delete FJpg;
>     }
>
>     void __fastcall TUpdateImage::Update(TIdPeerThread* AThread, TPicture*
> APicture);
>     {
>         TMemoryStream* TempStream = new TMemoryStream;
>         try
>         {
>             AThread->Connection->ReadStream(AStream, -1, false);
>             TempStream->Position = 0;
>
>             TUpdateImage* U = new TUpdateImage(AThread, TempStream,
> APicture);
>             try {
>                 U->Synchronize();
>             }
>             __finally {
>                 delete U;
>             }
>         }
>         __finally {
>             delete TempStream;
>          }
>     }
>
>     void __fastcall TUpdateImage::DoSynchronize()
>     {
>         FPicture->Assign(FJpg);
>     }
>
>
>     void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
>     {
>         AnsiString szCommand = AThread->Connection->ReadLn();
>         if( szCommand=="UPDATE_IMAGE" )
>             TUpdateImage::Update(AThread, Image1->Picture);
>     }
>
>
> Gambit
>
>
Technical Details
Message-ID: <418faf99$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <418f1c70$1@newsgroups.borland.com> <418f3099$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1e49695e4e7afe72
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII
From: "Willie" <Willie.nospam@nospam.pchome.com.tw>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <418f1c70$1@newsgroups.borland.com> <418f3099$1@newsgroups.borland.com>
Subject: Re: IdTCPServer & Image (Synchronize)
Date: Tue, 9 Nov 2004 01:52:41 +0800
Lines: 91
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 211.20.227.67
Message-ID: <418faf99$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099935641 211.20.227.67 (8 Nov 2004 09:40:41 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail