Board index » delphi » "Catastrophic Failure" - TIdWhoIs

"Catastrophic Failure" - TIdWhoIs

Hello all:

I am attempting to write an in-process COM program for use in an ASP page
that will gather specific WhoIs information on a domain by use of the
TIdWhoIs (Indy WhoIs Client) component.  My code works great as a
stand-alone application, however, when I copy the code into a function of an
automation object, it fails returning 'Catastrophic Failure'.  I've figured
out that I get the error as soon as I try to use the TIdWhoIs component.
What could be wrong?  For my USES I have IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient and IdWhois.  I am also declaring   IdWhois1:
TIdWhois; under my type.

Here's a snippet...

-------------------------------------------------------------------------

unit Unit1;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  ComObj, ActiveX, UMIWhoIsDLL_TLB, StdVcl, IdBaseComponent, IdComponent,
IdTCPConnection,
  IdTCPClient, IdWhois, Classes, SysUtils;

type
  TCoWhoIs = class(TAutoObject, ICoWhoIs)
  IdWhois1: TIdWhois;
  protected
    procedure whois(domain: OleVariant); safecall;
    function Get_info: OleVariant; safecall;
    { Protected declarations }
  end;

implementation

uses ComServ;
var
        strDomain: String;
        list: TStringList;
        whoisSvr: String;

procedure TCoWhoIs.whois(domain: OleVariant);
begin
        strDomain:=domain;
end;

function TCoWhoIs.Get_info: OleVariant;
var
        i, x: Integer;
begin
        list := TStringList.Create;

//        idwhois1.Host:='whois.internic.net';    <-------------This is
where is fails.
//        list.text := idwhois1.whois('=' + strDomain);
//        idwhois1.disconnect;

-------------------------------------------------------------------------

Thank you very much for your time,

Aaron

 

Re:"Catastrophic Failure" - TIdWhoIs


looks like you're not creating the idWhoIs component. Add the following
around the references to idwhois1:

  idwhois1 := tidWhoIs.create(nil);
  try
    // use the WhoIs component here
  finally
    idWhoIs1.free;
  end;

It's a common mistake - you're probably used to putting components on forms
where they get created for you.

brian

Quote
"A G" <aa...@ugomedia.com> wrote in message news:3ba0e324_1@dnews...
> Hello all:

> I am attempting to write an in-process COM program for use in an ASP page
> that will gather specific WhoIs information on a domain by use of the
> TIdWhoIs (Indy WhoIs Client) component.  My code works great as a
> stand-alone application, however, when I copy the code into a function of
an
> automation object, it fails returning 'Catastrophic Failure'.  I've
figured
> out that I get the error as soon as I try to use the TIdWhoIs component.
> What could be wrong?  For my USES I have IdBaseComponent, IdComponent,
> IdTCPConnection, IdTCPClient and IdWhois.  I am also declaring   IdWhois1:
> TIdWhois; under my type.

> Here's a snippet...

> -------------------------------------------------------------------------

> unit Unit1;

> {$WARN SYMBOL_PLATFORM OFF}

> interface

> uses
>   ComObj, ActiveX, UMIWhoIsDLL_TLB, StdVcl, IdBaseComponent, IdComponent,
> IdTCPConnection,
>   IdTCPClient, IdWhois, Classes, SysUtils;

> type
>   TCoWhoIs = class(TAutoObject, ICoWhoIs)
>   IdWhois1: TIdWhois;
>   protected
>     procedure whois(domain: OleVariant); safecall;
>     function Get_info: OleVariant; safecall;
>     { Protected declarations }
>   end;

> implementation

> uses ComServ;
> var
>         strDomain: String;
>         list: TStringList;
>         whoisSvr: String;

> procedure TCoWhoIs.whois(domain: OleVariant);
> begin
>         strDomain:=domain;
> end;

> function TCoWhoIs.Get_info: OleVariant;
> var
>         i, x: Integer;
> begin
>         list := TStringList.Create;

> //        idwhois1.Host:='whois.internic.net';    <-------------This is
> where is fails.
> //        list.text := idwhois1.whois('=' + strDomain);
> //        idwhois1.disconnect;

> -------------------------------------------------------------------------

> Thank you very much for your time,

> Aaron

Other Threads