Discussion:
How to get page wise results using PassthruAPP
(too old to reply)
g***@yahoo.co.in
2008-05-20 11:16:16 UTC
Permalink
Hello Igor,

I am using PassthruAPP in integration with IE & it works fine.
I am outputting the results in a separate file.

But when I open multiple windows in IE using "open in new window" all
the results (http request/response) from multiple windows gets mixed
together.

So, is there any way to distinguish which http request/response
belongs to which page ?

If yes, please let me know at the earliest.

Thanking You & Awaiting your reply,
Hitesh.
Igor Tandetnik
2008-05-20 11:57:05 UTC
Permalink
Post by g***@yahoo.co.in
I am using PassthruAPP in integration with IE & it works fine.
I am outputting the results in a separate file.
But when I open multiple windows in IE using "open in new window" all
the results (http request/response) from multiple windows gets mixed
together.
So, is there any way to distinguish which http request/response
belongs to which page ?
http://groups.google.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/browse_frm/thread/3a255f3cf3f827df
--
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
g***@yahoo.co.in
2008-05-21 12:22:19 UTC
Permalink
Post by g***@yahoo.co.in
I am using PassthruAPP in integration with IE & it works fine.
I am outputting the results in a separate file.
But when I open multiple windows in IE using "open in new window" all
the results (http request/response) from multiple windows gets mixed
together.
So, is there any way to distinguish which http request/response
belongs to which page ?
http://groups.google.com/group/microsoft.public.inetsdk.programming.w...
--
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
Hello Igor,

I have tried using IWindowForBindingUI : GetWindow() method in
CTestSink: OnResponse method -- to get the window handle.

But the GetWindow() method returns S_OK only for first couple of
responses & for rest of the responses it returns E_Fail.

So how do we find out which Request/Response pair belongs to which
window.
Igor Tandetnik
2008-05-21 12:30:17 UTC
Permalink
Post by g***@yahoo.co.in
Post by g***@yahoo.co.in
I am using PassthruAPP in integration with IE & it works fine.
I am outputting the results in a separate file.
But when I open multiple windows in IE using "open in new window"
all the results (http request/response) from multiple windows gets
mixed together.
So, is there any way to distinguish which http request/response
belongs to which page ?
http://groups.google.com/group/microsoft.public.inetsdk.programming.w...
I have tried using IWindowForBindingUI : GetWindow() method in
CTestSink: OnResponse method -- to get the window handle.
You have to use Switch/Continue trick to have this work reliably, as
discussed further in that thread.
--
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
g***@yahoo.co.in
2008-05-21 16:59:46 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
Post by g***@yahoo.co.in
I am using PassthruAPP in integration with IE & it works fine.
I am outputting the results in a separate file.
But when I open multiple windows in IE using "open in new window"
all the results (http request/response) from multiple windows gets
mixed together.
So, is there any way to distinguish which http request/response
belongs to which page ?
http://groups.google.com/group/microsoft.public.inetsdk.programming.w...
I have tried using IWindowForBindingUI : GetWindow() method in
CTestSink: OnResponse method -- to get the window handle.
You have to use Switch/Continue trick to have this work reliably, as
discussed further in that thread.
--
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- Hide quoted text -
- Show quoted text -
Hello Igor,

I understand that
1. I need to call the Switch() method of IInternetProtocolSink
Interface from within the OnResponse method.
2. Then Automatically Urlmoniker would call the
IInternetProtocolRoot : Continue() method in the main UI thread.
3. I should call IWindowForBindUI : GetWindow() method from within
the IInternetProtocolRoot:Continue() method

Please correct me if any of the above is wrong.

Now mu query is :--

1. From Where & How do I get the Pointer to IInternetProtocolSink
Interface for calling its Switch() method ??
2. Should I place the call to "IWindowForBindUI : GetWindow() method
" that is in the ProtocolImpl.inl file OR override it in the
TestAPP.cpp as we have done for OnResponse , OnBeginningtransaction()
methods.

Please help -- Sample Code would be appreciated and very helpful.

Thanks & Awaiting Your Reply,
Hitesh
Igor Tandetnik
2008-05-21 17:21:04 UTC
Permalink
Post by g***@yahoo.co.in
1. From Where & How do I get the Pointer to IInternetProtocolSink
Interface for calling its Switch() method ??
One is passed to Start. If you are using CustomSinkPolicy from my tookit
and provide your own sink object, then a) IInternetProtocolSink pointer
is cached as m_spInternetProtocolSink member of sink object, and b) the
protocol can get the pointer to your sink class by calling GetSink
method.

If you are not using CustomSinkPolicy, then you can simply cache the
pointer yourself in Start.
Post by g***@yahoo.co.in
2. Should I place the call to "IWindowForBindUI : GetWindow() method
" that is in the ProtocolImpl.inl file OR override it in the
TestAPP.cpp as we have done for OnResponse , OnBeginningtransaction()
methods.
You should call it.
--
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
g***@yahoo.co.in
2008-05-25 08:02:10 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
1. From Where & How do I get the Pointer to IInternetProtocolSink
Interface for calling its Switch() method ??
One is passed to Start. If you are using CustomSinkPolicy from my tookit
and provide your own sink object, then a) IInternetProtocolSink pointer
is cached as m_spInternetProtocolSink member of sink object, and b) the
protocol can get the pointer to your sink class by calling GetSink
method.
If you are not using CustomSinkPolicy, then you can simply cache the
pointer yourself in Start.
Post by g***@yahoo.co.in
2. Should I place the call to "IWindowForBindUI : GetWindow()  method
" that is in the ProtocolImpl.inl file OR override it in the
TestAPP.cpp as we have done for OnResponse , OnBeginningtransaction()
methods.
You should call it.
--
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
Hello Igor,
I have called the switch() from OnResponse method.It works fine.
Then call goes to the below mentioned Continue function in
ProtocolImpl.inl file.

inline STDMETHODIMP IInternetProtocolImpl::Continue(
/* [in] */ PROTOCOLDATA *pProtocolData)

I changed the code for continue() function in ProtocolImpl.inl file in
the following manner :---

inline STDMETHODIMP IInternetProtocolImpl::Continue(
/* [in] */ PROTOCOLDATA *pProtocolData)
{
ATLASSERT(m_spInternetProtocol != 0);
HRESULT hr = m_spInternetProtocol ? m_spInternetProtocol-
Post by Igor Tandetnik
Continue(pProtocolData) : E_UNEXPECTED;
REFGUID rguidReason = IID_IHttpSecurity;
HWND phwnd = NULL;
CComPtr<IWindowForBindingUI> spWindowForBindingUI;
QueryServiceFromClient(&spWindowForBindingUI);
hr = spWindowForBindingUI ? spWindowForBindingUI-
Post by Igor Tandetnik
GetWindow(rguidReason,&phwnd) : S_OK;
return hr;
}

But this gives me the error ---> error C3861:
'QueryServiceFromClient': identifier not found.

Am I doing something wrong ???

How do I solve this problem --- Please guide me !!

Thanks & Awaiting your reply,
Hitesh
Igor Tandetnik
2008-05-25 12:42:29 UTC
Permalink
Post by g***@yahoo.co.in
I have called the switch() from OnResponse method.It works fine.
Then call goes to the below mentioned Continue function in
ProtocolImpl.inl file.
inline STDMETHODIMP IInternetProtocolImpl::Continue(
/* [in] */ PROTOCOLDATA *pProtocolData)
I changed the code for continue() function in ProtocolImpl.inl file
Why? Simply override it in your protocol class. It's virtual.
Post by g***@yahoo.co.in
'QueryServiceFromClient': identifier not found.
This is a method of the sink class, not the protocol. It's very simple -
see how it's implemented, copy/paste the code. It's just a couple of
lines.
--
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
g***@yahoo.co.in
2008-05-25 15:15:15 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
I have called the switch() from OnResponse method.It works fine.
Then call goes to the below mentioned Continue function in
ProtocolImpl.inl  file.
 inline STDMETHODIMP IInternetProtocolImpl::Continue(
/* [in] */ PROTOCOLDATA *pProtocolData)
I changed the code for continue() function in ProtocolImpl.inl file
Why? Simply override it in your protocol class. It's virtual.
Post by g***@yahoo.co.in
'QueryServiceFromClient': identifier not found.
This is a method of the sink class, not the protocol. It's very simple -
see how it's implemented, copy/paste the code. It's just a couple of
lines.
--
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
Hello Igor,

I understand that I need to override it. But I am totally confused
about how to do it.

I tried overiding it using following ways but always landed with an
error.

1. class CTestSink :
public PassthroughAPP::CInternetProtocolSinkWithSP<CTestSink>,
public IHttpNegotiate,
public IInternetProtocol

2. class CTestSink :
public PassthroughAPP::CInternetProtocolSinkWithSP<CTestSink>,
public IHttpNegotiate,
public IInternetProtocolRoot

3. class CTestSink :
public PassthroughAPP::CInternetProtocolSinkWithSP<CTestSink>,
public IHttpNegotiate,
public IInternetProtocolImpl

4. class CTestSink :
public PassthroughAPP::CInternetProtocolSinkWithSP<CTestSink>,
public IHttpNegotiate,
public PassthroughAPP::CInternetProtocolImpl

I am confused about how to override it !!!

One more thing -----

Below is the code for continue() . Is it OK ?

STDMETHODIMP CTestSink::Continue()
{
USES_CONVERSION;
ATLASSERT(m_spInternetProtocol != 0);
HRESULT hr = m_spInternetProtocol ? m_spInternetProtocol-
Post by Igor Tandetnik
Continue(pProtocolData) : S_OK;
REFGUID rguidReason = IID_IHttpSecurity;
HWND phwnd = NULL;
CComPtr<IWindowForBindingUI> spWindowForBindingUI;
QueryServiceFromClient(&spWindowForBindingUI);
HRESULT hr = spWindowForBindingUI ?
spWindowForBindingUI->GetWindow(rguidReason,&phwnd) : S_OK;
return hr;

}

Please let me know how to override it &&
Whether above Continue() function is right for the overriding
implementation ???

Thanks & Awaiting your reply,
Hitesh
Igor Tandetnik
2008-05-26 13:57:43 UTC
Permalink
Post by g***@yahoo.co.in
Post by Igor Tandetnik
Post by g***@yahoo.co.in
I changed the code for continue() function in ProtocolImpl.inl file
Why? Simply override it in your protocol class. It's virtual.
I understand that I need to override it. But I am totally confused
about how to do it.
I tried overiding it using following ways but always landed with an
error.
Continue is a method on the protocol, not the sink. It goes into
CTestAPP (which already derives from IInternetProtocolImpl, of course).
Post by g***@yahoo.co.in
Below is the code for continue() . Is it OK ?
STDMETHODIMP CTestSink::Continue()
Again, it should go on CTestAPP
Post by g***@yahoo.co.in
QueryServiceFromClient(&spWindowForBindingUI);
From inside CTestAPP, you won't be able to call QueryServiceFromClient.
It's a very simple helper method. Just copy and paste its code. Or else,
have CTestAPP::Continue call some method you define on CTestSink - it's
probably more convenient to get to various pieces needed from there.
--
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
g***@yahoo.co.in
2008-05-27 09:04:16 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
Post by Igor Tandetnik
Post by g***@yahoo.co.in
I changed the code for continue() function in ProtocolImpl.inl file
Why? Simply override it in your protocol class. It's virtual.
I understand that I need to override it. But I am totally confused
about how to do it.
I tried overiding it using following ways but always landed with an
error.
Continue is a method on the protocol, not the sink. It goes into
CTestAPP (which already derives from IInternetProtocolImpl, of course).
Post by g***@yahoo.co.in
Below is the code for continue() . Is it OK ?
STDMETHODIMP CTestSink::Continue()
Again, it should go on CTestAPP
Post by g***@yahoo.co.in
QueryServiceFromClient(&spWindowForBindingUI);
From inside CTestAPP, you won't be able to call QueryServiceFromClient.
It's a very simple helper method. Just copy and paste its code. Or else,
have CTestAPP::Continue call some method you define on CTestSink - it's
probably more convenient to get to various pieces needed from there.
--
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
Hello Igor,
Thanks for your explanation, but before I implement the same I have
one query.

1. By calling Switch() method in OnResponse() method , it should call
Continue() method on the main thread.
To test this I called GetCurrentThreadId() method from
within the Continue() method. But to my surprise-- it gave me
different thread id's.

Am I testing it wrongly ??
Would using the GetWindow() method would give the same thread ID ??

By the way , I have an older version of Passthruapp (the one that has
typedef
PassthroughAPP::CustomSinkStartPolicy<CTestSink>TestStartPolicy; &
not <CTestAPP,CTestSink> ). This version donot have GetSink() method.

Is PassthruAPPBeta.zip is the new version ?? OR there is some other
version which I am unaware of ??
Igor Tandetnik
2008-05-27 11:45:59 UTC
Permalink
Post by g***@yahoo.co.in
1. By calling Switch() method in OnResponse() method , it should call
Continue() method on the main thread.
To test this I called GetCurrentThreadId() method from
within the Continue() method. But to my surprise-- it gave me
different thread id's.
Different than what? Did you pass PD_FORCE_SWITCH flag to Switch?
Post by g***@yahoo.co.in
Would using the GetWindow() method would give the same thread ID ??
I don't understand. How does GetWindow give you a thread ID?
Post by g***@yahoo.co.in
By the way , I have an older version of Passthruapp (the one that has
typedef
PassthroughAPP::CustomSinkStartPolicy<CTestSink>TestStartPolicy; &
not <CTestAPP,CTestSink> ). This version donot have GetSink() method.
In this version, the sink object is simply a member variable of the
protocol object, named m_sink if I recall correctly.
Post by g***@yahoo.co.in
Is PassthruAPPBeta.zip is the new version ??
Yes.
--
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
g***@yahoo.co.in
2008-05-27 12:05:53 UTC
Permalink
Post by Igor Tandetnik
Post by g***@yahoo.co.in
1. By calling Switch() method in OnResponse() method , it should call
Continue() method on the main thread.
              To test this I called GetCurrentThreadId() method from
within the Continue() method. But to my surprise-- it gave me
different thread id's.
Different than what? Did you pass PD_FORCE_SWITCH flag to Switch?
Post by g***@yahoo.co.in
Would using the GetWindow() method would give the same thread ID ??
I don't understand. How does GetWindow give you a thread ID?
Post by g***@yahoo.co.in
By the way , I have an older version of Passthruapp (the one that has
typedef
PassthroughAPP::CustomSinkStartPolicy<CTestSink>TestStartPolicy;   &
not  <CTestAPP,CTestSink> ). This version donot have GetSink() method.
In this version, the sink object is simply a member variable of the
protocol object, named m_sink if I recall correctly.
Post by g***@yahoo.co.in
Is PassthruAPPBeta.zip  is the new version ??
Yes.
--
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
Hello Igor,

Different thread id means -->
1. I navigate to a web page say, www.xyz.com
2. I have already set PD_FORCE_SWITCH flag & then called Switch() in
OnResponse method.
3. Then control would go to Continue() method where I am noting down
the current thread ID using the GetCurrrentThreadId().
4. I am printing these thread id's into a file from this Continue()
function.
5. After navigating the page , I read the file for getting the thread
id's & I find different thread id's for a single web page.

I think I am doing something wrong, but unable to figure it out.

Thanks & Regards
Hitesh.

Loading...