Link to home
Start Free TrialLog in
Avatar of MrNet
MrNet

asked on

Excute CGI onLoad

Hi,

I made a small (Text-Based) Counter using Delphi cgi ..

Please tell me How I excute it in my index.htm file .. is there a special HTML tag or what ??!!!

Note : I Want to get TEXT-BASED Counter
Avatar of DragonSlayer
DragonSlayer
Flag of Malaysia image

what does the counter return?  (I mean in what format and WHAT...)
Avatar of simonet
A graphical counter would be easier to add to the page.

If you want, I have the source for a graphical CGI counter, made in Delphi, and the source to add it to the page.

Alex
Avatar of MrNet
MrNet

ASKER

DragonSlayer,
the counter return PLAIN-TEXT number .. I should use HTML tags to decorate it like :
<font color="red"><#COUNTER></font>
but that could't run in TEXT-Counters.


simonet,
Actually I have an old Graphical if you can send me the source for your counter I will be happy ..

my EMail: MrNet10@hotmail.com

Hi MrNet;

I made this recently;

The tag is like this

< IMG = "http://??????/?????/YourCounter.DLL?Parm1=?&Param2=??" >


At your dll put the method to get and read the values to better process.
with Response do:
1 - Save a JPG image to a stream set the position to 0
2 - Do response.ContentStream:=stream
3 -Call Response.SendResponse.

Warning dont call Streamer.Free before afterDispacth.

If necessary a snap of code

      try
            //Pega nome do contador
            CounterName:=Request.QueryFields.Values[ 'countername' ];
            if CounterName = EmptyStr then begin
                  SendErrorImg( Response );
                  Exit;
            end;

            //Checa se ha setvalue ##alteraca do valor
            if Request.QueryFields.Values[ 'set' ] <> EmptyStr then begin
                  try
                        CountID:=StrToInt( Request.QueryFields.Values[ 'set' ] );
                  except
                        SendErrorImg( Response );
                        Exit; //Cancela atualizacao
                  end;
                  Self.SetCountValue( CounterName , CountID )
            end;

            //Pega valor apos ter incrementado anterior
            CountID:=ProcessCountID( CounterName );
            if CountID <> 0 then begin
                  Img:=TJPEGImage.Create;
                  try
                        Self.GetNumberImg( CountId, Img );
                        Strm:=TMemoryStream.Create;
                        try
                              Img.SaveToStream( Strm );
                              Strm.Position:=0;
                              Response.ContentType:='image/jpeg';
                              Response.ContentStream:=Strm;
                              Response.SendResponse;
                        finally
                              //Nao liberar o streamer aqui isso sera feito apos dispatch !!!!!!!!!!!!!
                        end;
                  finally
                        Img.Free;
                  end;
            end else begin
                  //Falha no processo deve ser informada com grafico correlato
                  Self.SendErrorImg( Response );
            end;
      finally
            Handled:=True;
      end;
end;

the comments in portuguese, sorry.

T++, Radler.
MrNet;

Sorry again;
I stay empolged and send to a image based case.
And again and again, I don't see the Simonet comment.

T++, Radler.
Avatar of MrNet

ASKER

Thanx Radler,

but I asked about another thing.


Pls .. if you know, try help me.

ASKER CERTIFIED SOLUTION
Avatar of HamidHossain
HamidHossain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial