When using CHtmlView to write your own browser, if you do not want to click on some links to create a new window, directly in the original window or a new window to display the page, use NEWWINDOW3 intercept and get the page URL
1. First add the following code to the header file of the class
void NEWWINDOW3 (IDispatch **ppdisp, Variant_bool *Cancel, DWORD DwFlags, BSTR Bstrurlcontext, BSTR bstrURL);D Eclare_ Eventsink_map ()
2. Add the following code to the CPP
Begin_eventsink_map (Myhtmlview, CHtmlView) 273 , NEWWINDOW3, Vts_pdispatch vts_pbool vts_i4 vts_bstr vts_bstr) End_eventsink_map ()
3. Implementation of functions
void MYHTMLVIEW::NEWWINDOW3 (IDispatch **ppdisp, Variant_bool *Cancel, DWORD DwFlags, BSTR Bstrurlcontext, BSTR bstrURL) { *cancel = TRUE; Navigate2 (bstrURL);}
Where Cancel is assigned true, the Web page is not automatically opened with the default browser.
bstrURL is the URL of the Web page that is about to open
The resulting bstrurl is used to transfer directly or create a new window yourself.
CHtmlView Interception of new window generation-NEWWINDOW3