- From: Philip Stuyck <philip.stuyck@alcatel.be>
- Date: Wed, 20 Sep 2000 08:13:47 +0200
- To: www-lib@w3.org
- Message-ID: <39C8559B.A30EDC7F@alcatel.be>
Hello, I am trying to make a progress indicator that shows the number of bytes received so far in a progress dialog. It is unknown what the size will be in advance because it is the result of a cgi. The code below tries to get the total size, but that is not the point I am trying to make. When I use the HTRequest_bodyRead(request); function in a progress handler function it does not return anything (yeah 0). When I use the HTRequest_bytesRead(request);function in a progress handler function it does return something but not the correct values (I think). Some cgi's produce a rather big output which take a while to receive at the client. It would be nice to show something moving at the client, like the number of bytes received. I also develop in Delphi, and there is a HTTP component that tells you the amount of bytes received so far.in a PacketReceived event handler So at least I think it should be possible to do it. And this strikes me as very similar as the progress handler in libwww. But probably I am doing something wrong. Do I have to register something ? Also the msgnum and defaultmessage in the progress handler function do not contain anything which I think is very strange. ???? (I saw this during debug) PRIVATE int webprogress_handler(HTRequest* request, HTAlertOpcode op,int msgnum,const char* defaultmessage, void* input,HTAlertPar* reply){} This chunk of code I am using : case HT_PROG_READ : { long cl = HTAnchor_length(HTRequest_anchor(request)); cl = 1; //just to trick the if into true if (cl > 0) { long b_read = HTRequest_bodyRead(request); double pro = (double) b_read/cl*1/*00 do not see why it should be in kbytes*/; char buf[10]; char sbuf[10]; HTNumToStr((unsigned long) cl, buf, 10); HTNumToStr(pro,sbuf,10); char message[255]="read "; strcat(message,sbuf); strcat(message," of "); strcat(message,buf); ((tMainWindow*)qApp->mainWidget())->setDomainIndicator(message); } else ((tMainWindow*)qApp->mainWidget())->setDomainIndicator("reading..."); } break; thanks in advance Philip Stuyck
Received on Wednesday, 20 September 2000 02:14:30 UTC