Using the URL Functions

Using the URL Functions


The URLDownloadToCacheFile, URLDownloadToFile, URLOpenBlockingStream, URLOpenPullStream, and URLOpenStream functions combine the capabilities of asynchronous monikers and URL monikers into easy-to-use functions.

The following sample demonstrates how to use the URLOpenBlockingStream function.

IStream* pStream;
char buffer[0x100];
DWORD dwGot;
HRESULT hr = NOERROR;

//open a blocking type stream to the website stored in the string szWebSite.
URLOpenBlockingStream( 0, szWebSite, &pStream, 0, 0);

do {
    hr = pStream->Read( buffer, sizeof(buffer), &dwGot );
    // do something with contents of buffer 
} while( SUCCEEDED(hr) && hr != S_FALSE);

return TRUE;

pStream->Release();

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.