If you're using MFC, have you considered using CInternetSession and CHttpFile?
I'm using these without any problems (IE8 installed)
A quick snippet of code I'm using:
CInternetSession internetSession;
CHttpFile *pHttpFile =
reinterpret_cast< CHttpFile* >( internetSession.OpenURL( L"www.example.com" ) );
DWORD dwStatusCode;
if ( pHttpFile->QueryInfoStatusCode( dwStatusCode ) &&
dwStatusCode == HTTP_STATUS_OK )
{
char szBuffer[ BUFFER_SIZE ];
DWORD dwBufferIndex = 0;
DWORD dwBytesRead = (DWORD)pHttpFile->Read( &szBuffer[ dwBufferIndex ], CHUNK_SIZE );
while ( dwBytesRead > 0 && dwBufferIndex < BUFFER_SIZE )
{
dwBufferIndex += dwBytesRead;
// break out if cancelled
if ( m_bCancel )
break;
dwBytesRead = (DWORD)pHttpFile->Read( &szBuffer[ dwBufferIndex ], CHUNK_SIZE );
}
szBuffer[ dwBufferIndex ] = '\0';
// szBuffer now contains the file contents
}
pHttpFile->Close();
delete pHttpFile;
This is what I'm currently using - I need a buffer that contains the contents, however modifying this code to write to a file instead shouldn't be too much of a problem.