Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to handle IMoniker::BindToStorage ?

270 views
Skip to first unread message

Robert Sweitzer

unread,
May 4, 1998, 3:00:00 AM5/4/98
to

I am experiencing some difficulty implementing a moniker provider. When I
enter "mk:@mymoniker:nnn" in IE4, my object gets instantiated and finally
IMoniker::BindToStorage() gets called. If I simply return an IStream
containing some HTML, the browser hangs indicating "Web site found. Waiting
for reply...". I've taken this to mean that perhaps it's waiting on me to
call it's IBindStatusCallback. Unfortunately I can't seem to figure out how
to obtain this interface from the caller's IBindCtx. Any ideas ?


Danpo Zhang

unread,
May 4, 1998, 3:00:00 AM5/4/98
to

Why can't you use pluggable protocol to achieve this?
all you need to is to implement a pluggable protocol
foo:// then when user enter foo://yourdoc, your protocol
will return the document and IE4 will display it.

Implement customer Moniker seems to be too much
heavy weighted.

Thanks!
danpo

Robert Sweitzer <rob...@drte.com> wrote in message
Oey5LR5...@uppssnewspub04.moswest.msn.net...

Robert Sweitzer

unread,
May 5, 1998, 3:00:00 AM5/5/98
to

Hi Danpo

Thanks for the fast response!

I implemented my own IStream interface (I was using CreateStreamOnHGlobal)
and found the problem. It seems my caller depends on IStream::Read returning
S_FALSE on end of stream so it simply looped forever. Bottom line -> be
carefull where you use the the compound file implementation of IStream.

Passing in an html stream causes the page to be displayed and I can control
the source - this is great ! However I would also like to display my custom
(inproc) document servers (inplace). I've tried streaming in doc files
without any success. IE4 prompts for a file to download, continuing, the
download hangs with the progress bar at 100 percent. How can I get IE4 to
(quietly) display my document ?

I intend to put all of this in an (standalone/nonnetworked) application that
hosts the WebBrowser control. While I guess I could stream out some html to
embedd my document, I suspect this would create an (unnecessary) mshtml
document server containing an (unnecessary) WebBrowser control ?

Thanks again,
Bob

PS: I'll put my pluggable protocol questions in another message.

Danpo Zhang wrote in message ...

Danpo Zhang

unread,
May 5, 1998, 3:00:00 AM5/5/98
to

Robert Sweitzer <rob...@drte.com> wrote in message

ew3xcUD...@uppssnewspub04.moswest.msn.net...


>Hi Danpo
>
>Thanks for the fast response!
>
>I implemented my own IStream interface (I was using CreateStreamOnHGlobal)
>and found the problem. It seems my caller depends on IStream::Read
returning
>S_FALSE on end of stream so it simply looped forever. Bottom line -> be
>carefull where you use the the compound file implementation of IStream.
>
>Passing in an html stream causes the page to be displayed and I can control
>the source - this is great ! However I would also like to display my custom
>(inproc) document servers (inplace). I've tried streaming in doc files
>without any success. IE4 prompts for a file to download, continuing, the
>download hangs with the progress bar at 100 percent. How can I get IE4 to
>(quietly) display my document ?

the hangs might be you are not calling OnStopBinding() so IE thinks
it is not done yet.

About the prompt for file download, it looks like IE does not know the
mime type so it can not automatically display the content.

does your Monkier get BindToObject() call? because that is the call
which is supposed to figure out which object to be created and that
object should resume the download.

Robert Sweitzer

unread,
May 5, 1998, 3:00:00 AM5/5/98
to

Hi DanPo

I am not calling IBindStatusCallback::OnStopBinding() - I am unable to
figure out how to retrieve it from IBindCtx passed in to BindToStorage().
How is this done ? EnumObjectParam() fails. I also tried
GetObjectParam(SZ_ASYNC_CALLEE, ...). By the way, a QI on the bind ctx for
IID_IAsyncCtx returns E_NOINTERFACE. Perhaps it has something to do with my
URL syntax to IE4 - "mk:@my.moniker:nnn" ?

BindToObject() is never called, at least not with the documents I've tested:
word, excel - not even with my 'functional' html document.

Bob

Karsten Zepner

unread,
May 13, 1998, 3:00:00 AM5/13/98
to

Hi Bob
I had the same problem. The result is very easy, but hard to find...
Sorry Danpo! But I think what Bob wants to know is how to
write a library like IVTMON.DLL.
The reason IE hangs is, IStream::Read returns S_OK instead of
S_FALSE at EOF. The following class will help:

CStreamImpl : public IStream
{
...
IStream* m_pStream;
STDMETHODIMP Read(LPBYTE pv, ULONG cb, ULONG* pcbRead)
{
// Get cbStream with Stat
if (m_cbRead == cbStream)
return S_FALSE;
HRESULT hr = m_pStream->Read(pv, cb, pcbRead);
if (SUCCEEDED(hr))
m_cbRead += *pcbRead;
return hr;
}
STDMETHODIMP Write(void const*, ULONG, ULONG*)
{ return ResultFromScode(E_NOTIMPL); }
STDMETHODIMP Seek(LARGE_INTEGER, DWORD, ULARGE_INTEGER*)
{ return ResultFromScode(E_NOTIMPL); }
...
}


Give me feeback. Do you work your own InfoViewer, too?
Thanks,
Karsten

karsten...@wolfsburg.de

Robert Sweitzer wrote in message ...

Robert Sweitzer

unread,
May 13, 1998, 3:00:00 AM5/13/98
to

Hi Karsten

Thanks for the response! I discovered this for myself and moved on to
new problems - follow along on this thread to 5/5/98. My moniker is
currently able to source html documents but not other document servers. Are
you also building custom document objects ?

Bob

Karsten Zepner wrote in message ...

Ranjiv Sharma

unread,
May 15, 1998, 3:00:00 AM5/15/98
to

I am having exactly the same problem. The problem is that the string under
which the
IBindStatusCallback is registered with the BindContext is not documented
anywhere - and as Robert
mentions, the EnumObjectParam is simply not implemented on any bind context
object.

I was able to register my IBindStatusCallback using my own string - and then
retrieve it successfully - so the mechanism seems
to work.

Please can someone point us to the string to use to get the
IBindStatusCallback from the BindContext

Thanks
-Ranjiv

Robert Sweitzer wrote in message ...

Ranjiv Sharma

unread,
May 15, 1998, 3:00:00 AM5/15/98
to

I Finally figured out the string used to register the IBindStatusCallback.
It is "_BSCB_Holder_".
It works - and this is how I figured it out

----------------------------------------------------
HRESULT hr = CreateBindCtx(0, &pbc);

IBindStatusCallback* pold;

// Here I just register my own string and interface pointer. The purpose
// is to get the address of the RegisterObjectParam vtable entry in
IBindCtx.
//I then set a break point on the entry point of RegisterBindStatusCallback
(in assembly)
//And hope that it will be called again when I call
RegisterBindStatusCallback(...)
pbc->RegisterObjectParam(L"IBindStatusCallback", &callback);

//Sure enough, the break point fired, and I just looked at what was passed
in on
// the stack.
hr = RegisterBindStatusCallback(pbc, &callback, &pold, 0);

Hope that helps

-Ranjiv

-----------------------------------------------------

0 new messages