🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
3 messages
3 total messages Started by Francisco navarro Mon, 13 Dec 2004 17:41
download file
#1448
Author: Francisco navarro
Date: Mon, 13 Dec 2004 17:41
3 lines
1021 bytes
I have one tcppbrowser component and I want to download one file from a web
page ( http://www.myyweb.com).
How can I do it ?
Re: download file
#1449
Author: Remy Lebeau (TeamB)
Date: Mon, 13 Dec 2004 19:10
18 lines
1547 bytes
"Francisco navarro" <paconava@telefonica.net> wrote in message
news:41bdd497@newsgroups.borland.com...

> I have one tcppbrowser component and I want to download
> one file from a web page ( http://www.myyweb.com).

Just Navigate() to the URL of the file.  The user will be prompted what to
do with the file - open it or save it.

However, if you want to download the file without user interaction, then I
suggest using an actual non-visual HTTP component instead, such as the one
provided in either Indy (http://www.indyproject.org) or ICS
(http://www.overbyte.be).  TCppWebBrowser is a visual component, meant for
user interaction.


Gambit
Re: download file
#1456
Author: Colin B Maharaj
Date: Sat, 18 Dec 2004 22:45
44 lines
2370 bytes
Francisco navarro wrote:

> I have one tcppbrowser component and I want to download one file from a web
> page ( http://www.myyweb.com).
> How can I do it ?
> 
> 

Try this.....Using a Button, a Memo and the URL in an Edit. Also the 
include is needed...


#include "WININET.h"


void __fastcall TForm1::Button1Click(TObject *Sender)
{
   HINTERNET hSession;
   AnsiString URLData = "";
   hSession = InternetOpen("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, 
NULL, 0);
   if (hSession)
   {
     HINTERNET hService;
     hService = InternetOpenUrl(hSession, Edit1->Text.c_str(), NULL, 0, 
0, 0);
     if (hService)
     {
        DWORD dwBytesAvailable, dwBytesRead=1;
        InternetQueryDataAvailable(hService, &dwBytesAvailable, 0, 0);
        char *lpBuffer = new char [dwBytesAvailable+1];
        while (dwBytesRead != 0)
        {
          InternetReadFile(hService, lpBuffer, dwBytesAvailable, 
&dwBytesRead);
          lpBuffer[dwBytesRead]=NULL;
          URLData += lpBuffer;
        }
        delete lpBuffer;
        Memo1->Text = URLData;
     }
   }
   InternetCloseHandle(hSession);
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads