Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Tue, 26 Jul 2005 11:16:27 +0800,    group: microsoft.public.inetsdk.programming.urlmonikers        back       


Using IMoniker to download files?   
Hi,

I'm looking for better alternatives to URLDownloadToFile/URLOpenStream. From
what I understand, these APIs are synchronized APIs. They won't return
before the download finishes. They won't even if I specify the
BINDF_ASYNCHRONOUS flag in IBindStatusCallback::GetBindInfo.

As I've been searching, I found the following implementation segment, that
appeared to be asynchronous.

   IMoniker* pMoniker;
   IBindCtx* pBindCtx;
   IBindStatusCallback *pOldCB;
   IStream* pStreamDummy = NULL;
   hr = CreateURLMoniker(0, szwUrl, &pMoniker);
   hr = CreateAsyncBindCtx(0, pIECallback, 0, &pBindCtx);
   hr = RegisterBindStatusCallback (pBindCtx, pIECallback, &pOldCB, 0);
   hr = pMoniker->BindToStorage(pBindCtx, 0, IID_IStream,
(void**)&pStreamDummy);
   Sleep(5000); // just to clarify the problem

*pIECallback implements IBindStatusCallback. I'm sure it's correct as I've
been testing it using URLOpenStream. It reports progress and writes data
correctly.

However, the above code piece doesn't initiate a downloading process. The
first 3 "hrs" are all S_OK. And the last "hr" is 0x000401e8. I checked the
source code, and found no defined macro for this error code. pStreamDummy is
still NULL after this call.

Any ideas on how to get it work?

Best regards,
-- 
He Shiming
date: Tue, 26 Jul 2005 11:16:27 +0800   author:   He Shiming mailbill(NOSPAM)@21cn.com.nospam

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us