只是学习过程中的记录,不是技术文章,大家要学技术的就不要往下看了,以免耽误你的时间,如果你还能给我点指引,那就更好了。
在研究如何再webbrowser中实现自定义下载的文章中,很多都提到需要通过RegisterBindStatusCallback 来获取下载文件名,又提到通过URL Monikers获取,可我看URL Monikers的介绍:(http://msdn.microsoft.com/en-us/library/aa741006(v=vs.85).aspx)
Creating a URL Moniker
Follow these steps to create a URL moniker for an application:
- Optional, but recommended. Implement the IBindStatusCallback interface.
- Optional, but recommended. Create an instance of your IBindStatusCallback interface.
- Call CreateURLMoniker with the URL and get the IMoniker interface.
- Call CreateAsyncBindCtx and get the IBindCtx interface.
- If IBindStatusCallback has been implemented, call RegisterBindStatusCallback with the IBindCtx and IBindStatusCallback interfaces.
- Call one of the IMoniker binding methods (either IMoniker::BindToStorage or IMoniker::BindToObject) with the IBindCtx interface. In the asynchronous case (where IBindStatusCallback has been implemented), the client application can get a pointer to theIStream orIStorage interface. The client application should call the IUnknown::Release method on the interface and use the interface returned in theIBindStatusCallback::OnDataAvailable call.
-
If IBindStatusCallback has been implemented, the IBindStatusCallback::GetBindInfo method is called by the IMoniker binding method to get the bind information.
Warning The size of the BINDINFO structure used by IBindStatusCallback::GetBindInfo has changed in Microsoft Internet Explorer 4.0 and later. Developers must write code that checks the size of theBINDINFO structure that is passed into their implementation of theIBindStatusCallback::GetBindInfo method before writing to members of the structure. For more information, see theHandling BINDINFO Structures section.
- If IBindStatusCallback has been implemented, the IBindStatusCallback::OnStartBinding method will be called.
- If IBindStatusCallback has been implemented, the IBindStatusCallback::OnProgress method will be called.
- If IBindStatusCallback has been implemented, either IBindStatusCallback::OnDataAvailable (if IMoniker::BindToStorage was used) or IBindStatusCallback::OnObjectAvailable (if IMoniker::BindToObject was used) will be called.
- If IBindStatusCallback has been implemented, steps 9 and 10 are repeated until the binding is completed.
- If IBindStatusCallback has been implemented, the IBindStatusCallback::OnStopBinding method will be called.
而在 IDOWNLOADMANAGER::DOWNLOAD中也说到:(http://msdn.microsoft.com/en-us/library/aa753612(v=vs.85).aspx)
Parameters
pmk [in] A pointer to an IMoniker interface that specifies the object to be downloaded. pbc [in] A pointer to an IBindCtx interface that specifies information used by the moniker in the bind process. dwBindVerb [in] A value of type DWORD that specifies the action to be performed during the bind process. grfBINDF [in] A value of type LONG that specifies a combination of values taken from the BINDF enumeration indicating how the bind process is handled. pBindInfo [in] A pointer to a variable of type BINDINFO that specifies the client application's requirements for binding. pszHeaders [in] A value of type LPCOLESTR that specifies additional headers to use with IHttpNegotiate. pszRedir [in] A value of type LPCOLESTR that specifies the URL that the moniker is redirected to. uiCP [in] A value of type UINT that specifies the code page of the object's display name.
- 其实,如果实现了IDOWNLOADMANAGER,与 URL Monikers的前4个步骤区别就只差 IBindStatusCallback interface了.不知从 pBindInfo 是否能获得 IBindStatusCallback interface呢?