|
|
|
date: Tue, 7 Mar 2006 21:42:25 +0800,
group: microsoft.public.inetsdk.programming.urlmonikers
back
Show default flash in the page
Hi,
I want to block flash and I registered temporary pluggable namespace,
implementated IInternetProtocol and IInternetProtocolSink. I have seized all
requests for flash files in Start function, so far it works well.
To provide users another choice to judge if he or she would like to see
the flash, I try to show a default flash file on the local machine, on which
can resume downloading the flash file by mouse click, just like a IE toolbar
named Infofo.
After I have read the local file in IStream object, and then write the
content in *pv in Read(void *pv, ULONG cb, ULONG *pcbRead) function. But
there is no flash show on the web page instead of a piece of blank.
I use Visual C++6.0 with ATL. Could anyone tell me why.
Thanks
date: Tue, 7 Mar 2006 21:42:25 +0800
author: Mike Chen
Re: Show default flash in the page
"Mike Chen" wrote in message
news:uJ2GtseQGHA.1556@TK2MSFTNGP09.phx.gbl
> I want to block flash and I registered temporary pluggable namespace,
> implementated IInternetProtocol and IInternetProtocolSink.
I understand IInternetProtocol, but how and why do you implement
IInternetProtocolSink?
> I have
> seized all requests for flash files in Start function, so far it
> works well. To provide users another choice to judge if he or she
> would like to see
> the flash, I try to show a default flash file on the local machine,
The easiest way to do this is probably to redirect to file:// protocol.
Once you recognize a URL you want to redirect, call
IInternetProtocolSink::ReportResult, passing INET_E_REDIRECT_FAILED as
an error code and file:// URL to the local file in szResult. IE will
retry the request with the new URL.
> on which can resume downloading the flash file by mouse click, just
> like a IE toolbar named Infofo.
> After I have read the local file in IStream object, and then write
> the content in *pv in Read(void *pv, ULONG cb, ULONG *pcbRead)
> function. But there is no flash show on the web page instead of a
> piece of blank. I use Visual C++6.0 with ATL. Could anyone tell me
> why.
Are you reporting the MIME type with
ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) ? Does the request come
with BINDF_NEEDFILE flag, and if so, do you honor it by calling
ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) ?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Tue, 7 Mar 2006 08:49:06 -0500
author: Igor Tandetnik
Re: Show default flash in the page
"Mike Chen" wrote in message
news:ejz%23EFrQGHA.1204@TK2MSFTNGP12.phx.gbl
> I have tried to redirect the URL, the IE status bar indicates that
> there is still one item in downloading. The browser doesnot show the
> flash. Here is my code.
>
> hr = m_spInternetProtSink->ReportResult(S_FALSE,
> INET_E_REDIRECT_FAILED , L"file:///d|/chm/helpobject/info.swf");
hr = m_spInternetProtSink->ReportResult(INET_E_REDIRECT_FAILED,
0, L"file:///d|/chm/helpobject/info.swf");
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Wed, 8 Mar 2006 08:24:03 -0500
author: Igor Tandetnik
Re: Show default flash in the page
Thanks Igor.
I have tried in the way you told me, I am afraid it doesn't work.
Because I create a BHO object, then I add a new ATL object in the project,
implement the IInternetProtocol to filter URL request in Start function. I
register namespace in the BHO construction like this
m_spIntnSession->RegisterNameSpace(m_spClssFactory, CLSID_FileProtocol,
L"http", 0, NULL, 0),
so the program cannot deal with the file://. Can I register http and file
two protocols at same time.
It's said that Asynchronous Pluggable Protocol should call in a sequence
of start-lockrequest-read-terminate-unlockrequest in MSDN documents, but my
program went through start-read-terminate without lockrequest and
unlockrequest. Does something interrupt IE loading data.
date: Thu, 9 Mar 2006 17:29:18 +0800
author: Mike Chen
Re: Show default flash in the page
"Mike Chen" wrote in message
news:%23TA3jo1QGHA.2156@tk2msftngp13.phx.gbl
> Because I create a BHO object, then I add a new ATL object in the
> project, implement the IInternetProtocol to filter URL request in
> Start function. I register namespace in the BHO construction like this
> m_spIntnSession->RegisterNameSpace(m_spClssFactory,
> CLSID_FileProtocol, L"http", 0, NULL, 0),
> so the program cannot deal with the file://.
The idea is that a local file would be loaded normally, using the
built-in file: protocol handler.
> Can I register http and
> file two protocols at same time.
Yes you can, but it's not clear why you would want to.
> It's said that Asynchronous Pluggable Protocol should call in a
> sequence of start-lockrequest-read-terminate-unlockrequest in MSDN
> documents, but my program went through start-read-terminate without
> lockrequest and unlockrequest.
In my experience, LockRequest is called somewhere after Read returns
S_FALSE (indicating no data) for the first time, and only if the content
is served from the cache (the APP sends
BINDSTATUS_CACHEFILENAMEAVAILABLE notification). LockRequest is mostly
there to make sure a cache entry is not garbage-collected in the narrow
window after the APP finishes writing it but before the client has a
chance to open it for reading.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Thu, 9 Mar 2006 07:51:01 -0500
author: Igor Tandetnik
Re: Show default flash in the page
Thanks Igor
> The idea is that a local file would be loaded normally, using the
> built-in file: protocol handler.
Do you mean I should open a local file. I have opened the local file like
this:
const char* pFileName = "D:\\chm\\HelpObject\\info.swf";
HANDLE hFile = CreateFile(pFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL),
and read the file into a IStream, called
spInternetProtSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, m_lFileSize)
went into the Read(void *pv, ULONG cb, ULONG *pcbRead) function, the program
read the IStream to pv in turn from the beginning to the end,
m_spInternetProtSink->ReportData(BSCF_INTERMEDIATEDATANOTIFICATION,
m_lPosition, m_lFileSize);
return S_OK;
at last called
m_spInternetProtSink->ReportData(BSCF_LASTDATANOTIFICATION, m_lFileSize,
m_lFileSize);
m_spInternetProtSink->ReportResult(S_OK, 0, 0);
return S_FALSE;
> Yes you can, but it's not clear why you would want to.
If the temporary namespace supports both "http" and "file" protocols,
perhaps I can redirect to file:// with INET_E_USE_DEFAULT_PROTOCOLHANDLER.
date: Fri, 10 Mar 2006 21:34:41 +0800
author: Mike Chen
Re: Show default flash in the page
"Mike Chen" wrote in message
news:%23MwNPWERGHA.6084@TK2MSFTNGP14.phx.gbl
>> The idea is that a local file would be loaded normally, using the
>> built-in file: protocol handler.
> Do you mean I should open a local file.
Not really. Since you already have a file on disk, you can simply
redirect to it. IE will open it itself.
Yes you can, but it's not clear why you would want to.
> If the temporary namespace supports both "http" and "file" protocols,
> perhaps I can redirect to file:// with
> INET_E_USE_DEFAULT_PROTOCOLHANDLER.
You do _not_ need to implement a protocol in order to redirect to it.
INET_E_USE_DEFAULT_PROTOCOLHANDLER does _not_ redirect to a different
protocol. ReportResult(INET_E_REDIRECT_FAILED) does, as described in my
first message.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Fri, 10 Mar 2006 08:31:41 -0500
author: Igor Tandetnik
|
|