CHtmlView::OnBeforeNavigate2 try to spy
-
I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the destination, i.e. to call another functions in this application. In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now. So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this? Thanx in advance,:confused: -- regards Matthias
-
I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the destination, i.e. to call another functions in this application. In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now. So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this? Thanx in advance,:confused: -- regards Matthias
Am I using the right approach, or am I absolutely wrong? Sounds good to me. This is the way I do it.
OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) { char pmbbuf[MAX_PATH]; strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal); if(pmbbuf == the_link_i'm_overriding) { DoSomething(); *Cancel = TRUE; } }
-
Am I using the right approach, or am I absolutely wrong? Sounds good to me. This is the way I do it.
OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) { char pmbbuf[MAX_PATH]; strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal); if(pmbbuf == the_link_i'm_overriding) { DoSomething(); *Cancel = TRUE; } }
I'm writing an application that try to spy IE's HTTP requests. I want to get the headers and the respons headers. But OnBeforeNavigate2 gives only additional headers and there is no way to get respons headers at all. How can i do that? I think about getting the IPersist object of IE and then somehow add notification, but don't know how this can be done or if it worth trying. - - - - - - - - - - - - - - - - - - Memory leaks is the price we pay \0 01234567890123456789012345678901234