ActiveX Control
Hi Guys!
After working through the whole night without *any* result I've thought
to ask here for help.
I've got a standard ATL ActiveX Control that I've registered as Mime
Player for my custom file type in Internet Explorer 6. This works fine
when using the <object/> tag, I can load any url through the use of the
IPersistFile interface. But when directly opening my file in IE or
using an iframe, I won't get any call of my IPersistFile Interface. So
I've thought to implement the IPersistPropertyBag Interface, too, to
receive the "SRC" Property. Works quite nicely but when trying to use
URLDownloadToCache(..) then the IE Browser suddenly hangs or returns me
cache filenames that do not exist (eventhough their path looks quite
right). I've also tried to use the IBindHost which I'd prefer (but
asynchronous, how to do that?) but the following code has exactly the
same effect that IE is freezing and my data's never loaded. Btw I've
also tried to have a callback for my URLDownloadToCache() but the
OnDataAvailable() was never called!? Here's the code I've tried to use
last but as soon as I am using the BindToStorage then IE is frozen!?
//--------------------------------------------------------------------------
// IPersistPropertyBag
//--------------------------------------------------------------------------
STDMETHODIMP CMimePlayer::Load(IPropertyBag* pPropBag,IErrorLog*
pErrorLog)
{
ATLTRACE(_T("IPersistPropertyBag::Load\n"));
// The embedded object URL is passed as 'SRC' property
CComVariant v;
HRESULT hr = pPropBag->Read(_L("SRC"),&v,pErrorLog);
if (SUCCEEDED(hr)) {
CComPtr<IServiceProvider> pServiceProvider;
m_spClientSite->QueryInterface(IID_IServiceProvider,(void**)&pServiceProvider);
CComPtr<IBindHost> pBindHost;
if (pServiceProvider)
pServiceProvider->QueryService(SID_IBindHost,IID_IBindHost,(void**)&pBindHost);
CComPtr<IBindCtx> pBindCtx;
CreateBindCtx(0,&pBindCtx);
CComPtr<IMoniker> pMoniker;
if (pBindHost)
hr = pBindHost->CreateMoniker(v.bstrVal,pBindCtx,&pMoniker,0);
else
hr = CreateURLMoniker(NULL,v.bstrVal,&pMoniker);
IStream* m_pStream;
if (SUCCEEDED(hr))
hr =
pMoniker->BindToStorage(pBindCtx,0,IID_IStream,(void**)&m_pStream);
}
return hr;
}
I really really hope anyone can help me with that to load URLs as
content files into my ActiveX from within IE, no matter if its coming
from <object/>, <iframe/>, <embed/> or whatever!
thanks a thousand times,
Alexander