Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

downloading a web page

pcupkapcupka Member Posts: 2
I've been looking around the web for information on downloading a web page from a C++ or Visual C++ program. I've done it before in Perl and VB, but I can't find any information on doing it in C++.

Any help is appreciated!

-- Patrick Cupka

Comments

  • andrewgs73andrewgs73 Member Posts: 95
    : I've been looking around the web for information on downloading a web page from a C++ or Visual C++ program. I've done it before in Perl and VB, but I can't find any information on doing it in C++.
    :
    : Any help is appreciated!
    :
    : -- Patrick Cupka
    :

    You have done it through Microsoft Internet Transfer Control
    in VB, isn't it? You can also use Microsoft Internet Transfer
    Control in VC++. Go to projects - add to projects - components
    and control.
  • pcupkapcupka Member Posts: 2
    : You have done it through Microsoft Internet Transfer Control
    : in VB, isn't it? You can also use Microsoft Internet Transfer
    : Control in VC++. Go to projects - add to projects - components
    : and control.

    No, I used the Winsock Control ... I'll try that ITC component, thanks.
  • DB1DB1 Member Posts: 1,142
    : : You have done it through Microsoft Internet Transfer Control
    : : in VB, isn't it? You can also use Microsoft Internet Transfer
    : : Control in VC++. Go to projects - add to projects - components
    : : and control.
    :
    : No, I used the Winsock Control ... I'll try that ITC component, thanks.
    :

    You could also use CInternetSession, or InternetOpen..
  • davidisladavidisla Member Posts: 12
    : : : You have done it through Microsoft Internet Transfer Control
    : : : in VB, isn't it? You can also use Microsoft Internet Transfer
    : : : Control in VC++. Go to projects - add to projects - components
    : : : and control.
    : :
    : : No, I used the Winsock Control ... I'll try that ITC component, thanks.
    : :
    :
    : You could also use CInternetSession, or InternetOpen..
    :

    Hi, this code download a File from a web:

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

    bool InetStartup()
    {
    g_hInternet = InternetOpen( INTERNET_OPEN_TYPE_PRECONFIG,
    NULL,
    NULL,
    NULL,
    0 );

    HINTERNET hSession;
    DWORD dwContext = 0;

    hSession = InternetOpenUrl( g_hInternet,
    _T("http://www.stratos-ad.com/gfx/home_top_01.gif"),
    NULL,
    0,
    0,
    dwContext );

    char pBufferData[1024];
    DWORD dwBytesRead;
    DWORD dwBytesWrite;
    HANDLE hFile = CreateFile( _T("Dibujo.gif"),
    GENERIC_READ | GENERIC_WRITE,
    0,
    NULL,
    CREATE_NEW,
    FILE_ATTRIBUTE_NORMAL,
    NULL );

    while( InternetReadFile( hSession,
    pBufferData,
    1023,
    &dwBytesRead ) )
    {
    pBufferData[dwBytesRead] = 0;

    OutputDebugString( pBufferData );
    OutputDebugString( _T("
    ") );

    if( dwBytesRead == 0 ) break;

    WriteFile( hFile, pBufferData, dwBytesRead, &dwBytesWrite, NULL );
    }

    CloseHandle( hFile );

    IWebBrowser2 objWebBrowser;

    return true;
    }

    bool InetStop()
    {
    InternetCloseHandle( g_hInternet );
    return true;
    }

  • Justin BibJustin Bib USAMember Posts: 0

    || http://forcoder.org || free ebooks and video tutorials about ( C++ JavaScript Go PHP Visual Basic .NET PL/SQL C Objective-C C# Visual Basic Python MATLAB Delphi Ruby Perl Swift Java R Assembly Scratch Scheme Lisp Hack Erlang ABAP Prolog Scala Transact-SQL Rust Fortran Clojure Kotlin Crystal Bash Julia Lua F# D Dart Apex Alice LabVIEW SAS Logo COBOL Ada FoxPro Awk ML VBScript ) ____

Sign In or Register to comment.