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: Thu, 28 Jul 2005 15:55:39 +0800,    group: microsoft.public.inetsdk.programming.urlmonikers        back       


Asynchronous Monikers, thread bug?   
Hi,

I'm trying to use asynchronous monikers to download files. I've implemented 
CIEStatusCallback that derives from the IBindStatusCallback interface, and I 
initiate a download process the following way:

   IStream* pstm = NULL;
   IMoniker* m_pmk;
   IBindCtx* m_pbc;
   IBindStatusCallback* m_pbsc = new CIEStatusCallback();
   hr = CreateURLMoniker(NULL, tcwCanonicalizedUrl, &m_pmk); // S_OK
   hr = CreateBindCtx(0, &m_pbc); // S_OK
   hr = RegisterBindStatusCallback(m_pbc,m_pbsc, 0, 0L); // S_OK
   hr = m_pmk->BindToStorage(m_pbc, 0, IID_IStream, (void**)&pstm);
   // MK_S_ASYNCHRONOUS

The CIEStatusCallback has been tested with URLOpenStream API, and it should 
be correct. CIEStatusCallback::GetBindInfo() returns BINDF_ASYNCHRONOUS 
|BINDF_ASYNCSTORAGE | BINDF_PULLDATA.

I believed that I found a bug (or at least some kind of problem) in 
asynchronous URL monikers. If the above piece of code is called from the 
program window procedure (i.e. the WM_COMMAND handler for a button), it 
works fine. However, if I put this piece of code in a thread, it stopped 
working.

If I put the exact same code in a thread created by CreateThread, 
CIEStatusCallback::QueryInterface, ::GetBindInfo will be called as expected. 
But the downloading process didn't start after then. It appears that being 
called from a thread makes it impossible for the asynchronous moniker to 
create its own thread.

Could someone confirm this for me? Any suggestions?

Best regards,
-- 
He Shiming
date: Thu, 28 Jul 2005 15:55:39 +0800   author:   He Shiming mailbill(NOSPAM)@21cn.com.nospam

Google
 
Web ureader.com


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