L
linestyle
PassthruAPPBeta is a very good example for me,because i am a newby in APP.
I init the APP, use the BHO. And, I want to use the PassthruAPP to filter the *.swf file for IE,and i change the PassthruAPPBeta source in the follow:
(1) first time i add my code in the CustomSinkStartPolicy,the flash file is realy disappeared in the IE's view ,but one thing is coming , the real DISPID_DOCUMENTCOMPLETE(when the all IE needs files download) event is not produce,so many kill popup ad 's program is not get this event flag, So they kill the new window all the time,now i cann't open any new window in IE.
// ===== CustomSinkStartPolicy =====
template <class Protocol, class Sink>
inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl,
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
DWORD grfPI, HANDLE_PTR dwReserved,
IInternetProtocol* pTargetProtocol) const
{
ATLASSERT(pTargetProtocol != 0);
HRESULT hr;
Sink* pSink = GetSink(static_cast<const Protocol*>(this));
hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,
dwReserved, pTargetProtocol);
CComPtr<IInternetProtocolSink> spSink;
CComPtr<IInternetBindInfo> spBindInfo;
if (SUCCEEDED(hr))
{
hr = pSink->QueryInterface(IID_IInternetProtocolSink,
reinterpret_cast<void**>(&spSink));
ATLASSERT(SUCCEEDED(hr) && spSink != 0);
}
if (SUCCEEDED(hr))
{
hr = pSink->QueryInterface(IID_IInternetBindInfo,
reinterpret_cast<void**>(&spBindInfo));
ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0);
}
if (SUCCEEDED(hr))
{
USES_CONVERSION; //this ling me add
char *str=OLE2A(szUrl); //this ling me add
if(strlen(str) > 4) //this ling me add
{ //this ling me add
str = str + strlen(str) - 4; //this ling me add
if(_strnicmp(str,".swf",4) == 0) //this ling me add
{
return S_OK; //this ling me add
}
else
{
hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI,
dwReserved);
}
}
}
return hr;
}
(2)second time i delete the first time add the code ,add my in to IInternetProtocolRoot as following, but i have the same result as the first time.
// ===== CInternetProtocol =====
// IInternetProtocolRoot
template <class StartPolicy, class ThreadModel>
inline STDMETHODIMP CInternetProtocol<StartPolicy, ThreadModel>::Start(
LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
{
ATLASSERT(m_spInternetProtocol != 0);
if (!m_spInternetProtocol)
{
return E_UNEXPECTED;
}
USES_CONVERSION; //this ling me add
char *str=OLE2A(szUrl); //this ling me add
if(strlen(str) > 4) //this ling me add
{ //this ling me add
str = str + strlen(str) - 4; //this ling me add
if(_strnicmp(str,".swf",4) == 0) //this ling me add
{
return S_OK; //this ling me add
}
else
{
return StartPolicy::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,dwReserved, m_spInternetProtocol);
}
}
}
So ,i came here for help , sorry for my poor english , i have nothing good method to deal with it .
thank you for you read my problem , wait for nice person.
zhaoqigang
(e-mail address removed)
I init the APP, use the BHO. And, I want to use the PassthruAPP to filter the *.swf file for IE,and i change the PassthruAPPBeta source in the follow:
(1) first time i add my code in the CustomSinkStartPolicy,the flash file is realy disappeared in the IE's view ,but one thing is coming , the real DISPID_DOCUMENTCOMPLETE(when the all IE needs files download) event is not produce,so many kill popup ad 's program is not get this event flag, So they kill the new window all the time,now i cann't open any new window in IE.
// ===== CustomSinkStartPolicy =====
template <class Protocol, class Sink>
inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl,
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
DWORD grfPI, HANDLE_PTR dwReserved,
IInternetProtocol* pTargetProtocol) const
{
ATLASSERT(pTargetProtocol != 0);
HRESULT hr;
Sink* pSink = GetSink(static_cast<const Protocol*>(this));
hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,
dwReserved, pTargetProtocol);
CComPtr<IInternetProtocolSink> spSink;
CComPtr<IInternetBindInfo> spBindInfo;
if (SUCCEEDED(hr))
{
hr = pSink->QueryInterface(IID_IInternetProtocolSink,
reinterpret_cast<void**>(&spSink));
ATLASSERT(SUCCEEDED(hr) && spSink != 0);
}
if (SUCCEEDED(hr))
{
hr = pSink->QueryInterface(IID_IInternetBindInfo,
reinterpret_cast<void**>(&spBindInfo));
ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0);
}
if (SUCCEEDED(hr))
{
USES_CONVERSION; //this ling me add
char *str=OLE2A(szUrl); //this ling me add
if(strlen(str) > 4) //this ling me add
{ //this ling me add
str = str + strlen(str) - 4; //this ling me add
if(_strnicmp(str,".swf",4) == 0) //this ling me add
{
return S_OK; //this ling me add
}
else
{
hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI,
dwReserved);
}
}
}
return hr;
}
(2)second time i delete the first time add the code ,add my in to IInternetProtocolRoot as following, but i have the same result as the first time.
// ===== CInternetProtocol =====
// IInternetProtocolRoot
template <class StartPolicy, class ThreadModel>
inline STDMETHODIMP CInternetProtocol<StartPolicy, ThreadModel>::Start(
LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
{
ATLASSERT(m_spInternetProtocol != 0);
if (!m_spInternetProtocol)
{
return E_UNEXPECTED;
}
USES_CONVERSION; //this ling me add
char *str=OLE2A(szUrl); //this ling me add
if(strlen(str) > 4) //this ling me add
{ //this ling me add
str = str + strlen(str) - 4; //this ling me add
if(_strnicmp(str,".swf",4) == 0) //this ling me add
{
return S_OK; //this ling me add
}
else
{
return StartPolicy::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,dwReserved, m_spInternetProtocol);
}
}
}
So ,i came here for help , sorry for my poor english , i have nothing good method to deal with it .
thank you for you read my problem , wait for nice person.
zhaoqigang
(e-mail address removed)