🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

IdTCPServer & Image (Synchronize)

#4981
From: Willie
Date: Mon, 08 Nov 2004 07:24
36 lines
1728 bytes
Hello:

How can I update my Image?

TMemoryStream *ms1;
void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
{
   AnsiString szCommand=AThread->Connection->ReadLn();
   if(szCommand=="UPDATE_IMAGE")
   {
      ms1=new TMemoryStream;
      AThread->Connection->ReadStream(ms1, -1, false);
      ms1->SaveToFile("test.dat"); // for debug, check the received packet
is conrrect.
      AThread->Synchronize(&UpdateImage);
      delete ms1;
   }
}
void __fastcall TForm1::UpdateImage()
{
      TJPEGImage *jpg=new TJPEGImage;
      jpg->LoadFromStream(ms1);
      jpg->CompressionQuality=100;

      jpg->SaveToFile(IntToStr(j++)+".jpg"); // for debug, but never run to
this line.

      Image1->Picture->Assign(jpg);
      delete jpg;
}

How can I modify the code to work fine?

Thank you very much.

Willie.
Technical Details
Message-ID: <418f1c70$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1e49695e4e7afe72,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Willie" <Willie.nospam@nospam.pchome.com.tw>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: IdTCPServer & Image (Synchronize)
Date: Mon, 8 Nov 2004 15:24:50 +0800
Lines: 38
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: <418f1c70$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099897968 211.20.227.67 (7 Nov 2004 23:12:48 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail