URL Open Stream Functions

"...pass in a URL, get a stream..."

NOTE: THIS DOCUMENT IS AN EARLY RELEASE OF THE FINAL SPECIFICATION. IT IS MEANT TO SPECIFY AND ACCOMPANY SOFTWARE THAT IS STILL IN DEVELOPMENT. SOME OF THE INFORMATION IN THIS DOCUMENTATION MAY BE INACCURATE OR MAY NOT BE AN ACCURATE REPRESENTATION OF THE FUNCTIONALITY OF THE FINAL SPECIFICATION OR SOFTWARE. MICROSOFT ASSUMES NO RESPONSIBILITY FOR ANY DAMAGES THAT MIGHT OCCUR EITHER DIRECTLY OR INDIRECTLY FROM THESE INACCURACIES. MICROSOFT MAY HAVE TRADEMARKS, COPYRIGHTS, PATENTS OR PENDING PATENT APPLICATIONS, OR OTHER INTELLECTUAL PROPERTY RIGHTS COVERING SUBJECT MATTER IN THIS DOCUMENT. THE FURNISHING OF THIS DOCUMENT DOES NOT GIVE YOU A LICENSE TO THESE TRADEMARKS, COPYRIGHTS, PATENTS, OR OTHER INTELLECTUAL PROPERTY RIGHTS.


Contents

  1. Overview
  2. IBindStatusCallback
  3. URLDownloadToCacheFile
  4. URLDownloadToFile
  5. URLOpenStream
  6. URLOpenBlockingStream
  7. URLOpenPullStream
RELEASE NOTE FOR BETA2: Microsoft has found problems with the beta version of URLOpenBlockingStream. Also, the beta version of URLDownloadToCacheFile does not work with relative URLs. Both problems will be fixed in the final release.

Overview

Without a doubt the easiest, most efficient and most powerful way to download data from the Internet is using the new URL Open Stream (UOS) functions. Before jumping into the specifications, let's cover a few of the high-level features and the philosophy behind the creation of these functions. The UOS functions are the newest addition to the ActiveX(TM) extensions to the Win32 API. They combine the familiarity of C-style programming with the power of COM. These functions work equally well inside an ActiveX framework (for example, a component, a document or frame window, a subcomponent, or a scriptable object) or completely standalone.

Unlike other more complex interface negotiations, using these functions requires knowledge of no more than two COM interfaces, IStream and IBindStatusCallback.

Because these functions use services from URL monikers and WinInet, all the caching and thread synchronization features of those components are in use whenever you call these functions. In addition, the UOS functions handle all the host binding operations if your code is in an ActiveX container: the UOS functions automatically do the right thing to manage the download in the ActiveX client framework.

Every UOS function works in the same basic way: the caller implements an IBindStatusCallback interface (optional in some cases), then calls the function. The URLOpenStream and URLOpenPullStream functions require the caller to be on a thread that has a message loop (GetMessage/DispatchMessage). In the case of an ActiveX component, a message loop is a given if this function is called from the main thread. For a standalone application without a user interface, a message loop is still necessary for these functions.

With the URL Open Stream functions, you can:




The URL Open Stream functions are described below: