Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Sun, 8 Jun 2008 21:07:08 -0700 (PDT),    group: microsoft.public.inetsdk.programming.webbrowser_ctl        back       


Obtain URL from pluggable MIME filter   
I have a pluggable MIME Filter implementeed using
IInternetProtocolRoot, IInternetProtocolSink, etc..

The problem is - when the IInternetProtocolRoot::Start() method is
called, the "szUrl" parameter is the mime type, not the actual URL
that is being processed. Is there any way to get the actual URL ??
date: Sun, 8 Jun 2008 21:07:08 -0700 (PDT)   author:   Dave Brown

Re: Obtain URL from pluggable MIME filter   
"Dave Brown"  wrote in message
news:63a806e1-31ae-487a-8b28-cf19ca4a14ac@q27g2000prf.googlegroups.com
> I have a pluggable MIME Filter implementeed using
> IInternetProtocolRoot, IInternetProtocolSink, etc..
>
> The problem is - when the IInternetProtocolRoot::Start() method is
> called, the "szUrl" parameter is the mime type, not the actual URL
> that is being processed. Is there any way to get the actual URL ??

Try IInternetBindInfo::GetBindString(BINDSTRING_URL). Another thing to 
try is to query the "real" protocol (one whose pointer arrives in 
PROTOCOLFILTERDATA) for IWinInetInfo and call 
QueryOption(INTERNET_OPTION_URL).
-- 
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: Mon, 9 Jun 2008 07:52:39 -0400   author:   Igor Tandetnik

Re: Obtain URL from pluggable MIME filter   
GetBindString() worked, thanks!

Question -- do I need to free the memory allocated by GetBindString()
using CoTaskMemFree() or some other function? The MSDN docs are
unclear about this.


On Jun 9, 4:52 am, "Igor Tandetnik"  wrote:
> "Dave Brown"  wrote in message
>
> news:63a806e1-31ae-487a-8b28-cf19ca4a14ac@q27g2000prf.googlegroups.com
>
> > I have a pluggable MIME Filter implementeed using
> > IInternetProtocolRoot, IInternetProtocolSink, etc..
>
> > The problem is - when the IInternetProtocolRoot::Start() method is
> > called, the "szUrl" parameter is the mime type, not the actual URL
> > that is being processed. Is there any way to get the actual URL ??
>
> Try IInternetBindInfo::GetBindString(BINDSTRING_URL). Another thing to
> try is to query the "real" protocol (one whose pointer arrives in
> PROTOCOLFILTERDATA) for IWinInetInfo and call
> QueryOption(INTERNET_OPTION_URL).
> --
> 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: Mon, 9 Jun 2008 12:05:42 -0700 (PDT)   author:   Dave Brown

Re: Obtain URL from pluggable MIME filter   
Dave Brown  wrote:
> Question -- do I need to free the memory allocated by GetBindString()
> using CoTaskMemFree() or some other function? The MSDN docs are
> unclear about this.

It's somewhat complicated. GetBindString is designed to be able to 
return an array of strings (e.g. it may return several MIME types in 
response to BINDSTRING_ACCEPT_MIMES). So you pass an array of LPOLESTR 
pointers and the size of this array. GetBindString returns the number of 
entries it actually used in *pcElFetched, and allocates each string with 
CoTaskMemAlloc. You should deallocate them with CoTaskMemFree.

Luckily, only one string is ever returned in response to BINDSTRING_URL, 
which simplifies matters. You would do something like this:

LPOLESTR url = 0;
ULONG fetched = 0;
HRESULT hr = pIBI->GetBindString(BINDSTRING_URL, &url, 1, &fetched);
if (SUCCEEDED(hr) && fetched == 1) {
    // Use url
    CoTaskMemFree(url);
}

-- 
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: Mon, 9 Jun 2008 15:40:20 -0400   author:   Igor Tandetnik

Re: Obtain URL from pluggable MIME filter   
Awesome, thanks Igor!

On Jun 9, 12:40 pm, "Igor Tandetnik"  wrote:
> Dave Brown  wrote:
> > Question -- do I need to free the memory allocated by GetBindString()
> > using CoTaskMemFree() or some other function? The MSDN docs are
> > unclear about this.
>
> It's somewhat complicated. GetBindString is designed to be able to
> return an array of strings (e.g. it may return several MIME types in
> response to BINDSTRING_ACCEPT_MIMES). So you pass an array of LPOLESTR
> pointers and the size of this array. GetBindString returns the number of
> entries it actually used in *pcElFetched, and allocates each string with
> CoTaskMemAlloc. You should deallocate them with CoTaskMemFree.
>
> Luckily, only one string is ever returned in response to BINDSTRING_URL,
> which simplifies matters. You would do something like this:
>
> LPOLESTR url = 0;
> ULONG fetched = 0;
> HRESULT hr = pIBI->GetBindString(BINDSTRING_URL, &url, 1, &fetched);
> if (SUCCEEDED(hr) && fetched == 1) {
>     // Use url
>     CoTaskMemFree(url);
>
> }
>
> --
> 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: Mon, 9 Jun 2008 13:43:03 -0700 (PDT)   author:   Dave Brown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us