June 15th, 2009, 03:29 AM
Problems with IWebBrowser2 and frames
I have the following problem with an MFC application: in my app I have embedded internet explorer via a "standard" CWebBrowser2 wrapper and everything goes well (clicks, navigation, etcetc).
In my app I need to change "on the fly" the files that IE is going to show, for example: the user clicks to "original.html" and I show "processed.html", where processed.html is created on the fly from some dbase.
Till now I have done it using a OnBeforeNavigate2Explorer1 function like:
void CMyDlg::OnBeforeNavigate2Explorer1(LPDISPATCH pDisp,
VARIANT FAR* URL,
VARIANT FAR* Flags,
VARIANT FAR* TargetFrameName,
VARIANT FAR* PostData,
VARIANT FAR* Headers,
BOOL FAR* Cancel)
if( is_an_unprocessed_file( URL ))
// given the URL I create the output I want to show
// cancel navigation of the original file
*Cancel = (VARIANT_BOOL) 0xffff;
// fire navigation to the processed file
// if we are here IE is going to visit a processed file: it's ok.
*Cancel = (VARIANT_BOOL) 0x0;
everything works fine as far as original.html does not use frames.....
If original.html uses frames (either a frameset or an iframe) the "child" documents are not shown inside the main one but in a new window, i.e. a standard IE window pops up.
I have tried something with the TargetFrameName variable but with no luck...
Do you have any suggestion??
PS: I am running these tests in XP with IE6.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.