Mayayana
7/18/2011 2:30:00 AM
Is there a way to get at the HRESULT value and
return it from a Sub? Example: IInternetProtocol,
as typelibbed by Eduardo Morcillo, contains all subs.
The C++ version is all functions. I'm not actually sure
whether I need the function ability, but I'm still finding
something not quite right when
I return INET_E_USE_DEFAULT_PROTOCOLHANDLER,
telling urlmon that I don't want to process the current
file.
In samples I've found, there can be different return
values under different scenarios:
STDMETHODIMP CXMLMimeFilterPP::Terminate(DWORD dwOptions)
{
// irrelevant code here.
return m_pIncomingProt->Terminate(dwOptions);
}
In the only comparable code sample I can find, most
of the IInternetProtocol methods return E_UNEXPECTED
when not processing a file. So Terminate would return
E_UNEXPECTED or the result of
m_pIncomingProt->Terminate(dwOptions);
My method just passes on the call:
m_pIncomingProt.Terminate dwOptions
So I have a Terminate sub where I call the protocol
handler's Terminate sub, but in C++ they're both functions.
Even if I overwrite the vTable pointer for my function, I
can't return the result of my call to m_pIncomingProt.Terminate
Can I at least assume that sending a return value by
overwriting the vtable pointer is getting back to the
caller...in case I need to return E_UNEXPECTED? Assuming
that, is there a way to access the HRESULT return from my
call to m_pIncomingProt.Terminate? I've seen conflicting
discussions about using Err.Raise for that.
As noted above, I'm not even certain whether any of this
is relevant.
The mime filter is working fine, except that urlmon does not
entirely handle it when I reject a file. For instance, my filter
gets called for CHM files. I don't want to handle those. I
reject them based on their non-http URL. The result is that
CHM files work fine, but nothing loads into the right-hand pane
when they open. Ther's no browser window there -- just white.
Once a contents or index item is selected it's fine.
Likewise with OE. The first click on a newsgroup item shows
nothing in the message pane, but it works fine after that.
There seems to be something in IInternetProtocol that I'm
not responding to correctly.
(For anyone following this: If I reject a file I still need to pass
on calls I get to my IInternetProtocolSink implementation. If I
don't then OE/IE/CHM etc. will freeze. So I know that I have
to play a role in file processing, once I've been called, even if
I don't want to process that file. I just haven't figured out what
part of that role I'm missing, and I can't tell whether it might
depend on my returning something from an IInternetProtocol sub.
I could, perhaps, just process all files I receive and not edit
the ones I don't want to handle, but that gets into other issues
of dealing with cache files, etc. I'd rather keep it clean and
only handle webpages in IE.)