🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TIdHTTP component and BCB2006

#2190
From: masi
Date: Fri, 14 Jul 2006 20:03
55 lines
2799 bytes
> Do not use the OnCreate event in C++.  It is a Delphi idiom that can 
> produce
> illegal behavior in C++ as it can be triggered before the constructor. 
> Use
> the actual constructor instead.

I agree with you.
But the problem still remains even if I place the statement

  IdHTTP = new TIdHTTP(this);

into the constructor's body,
or in the Button's Click event handler, just before calling Get method.

The result is that, if I compile without checking 'build with runtime 
packages' option, application gives error in the execution of that 
statement:
   IdHTTP = new TIdHTTP(this);

Do you experience something different?
Because in that case there have to be something wrong in what I do.

Here's complete code:

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include <IdHTTP.hpp>

#include "Unit1.h"

TIdHTTP *IdHTTP;

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  IdHTTP = new TIdHTTP(this);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Memo1->Text = IdHTTP->Get(Edit1->Text);
}
//---------------------------------------------------------------------------

Many thanks.

masi urbano 
Technical Details
Message-ID: <44b7f878$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!colt.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44b39b74$1@newsgroups.borland.com> <44b3d495$1@newsgroups.borland.com> <44b4c278@newsgroups.borland.com> <44b52936$1@newsgroups.borland.com> <44b75aa5@newsgroups.borland.com> <44b7c6f8$3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,58cbb7a88b1fb79d
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "masi" <masiurb@tin.it>
From: "masi" <masiurb@tin.it>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <44b39b74$1@newsgroups.borland.com> <44b3d495$1@newsgroups.borland.com> <44b4c278@newsgroups.borland.com> <44b52936$1@newsgroups.borland.com> <44b75aa5@newsgroups.borland.com> <44b7c6f8$3@newsgroups.borland.com>
Subject: Re: TIdHTTP component and BCB2006
Date: Fri, 14 Jul 2006 22:03:05 +0200
Lines: 57
Organization: urbano
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 84.220.86.69
Message-ID: <44b7f878$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1152907384 84.220.86.69 (14 Jul 2006 13:03:04 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!colt.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail