Add navigateerror event response for the chtmlview inheritance class of vc6

Source: Internet
Author: User
From: http://blog.csdn.net/sheds/archive/2007/02/14/1510232.aspx

In vc7, The chtmlview class itself has an onnavigateerror event response.
However, vc6 does not. After some experiments, we can find the following method to add this response for vc6:

For example, chtmlctrl

Add the following content to the header file:

# Define dispid_navigateerror 271

Declare_eventsink_map ()

Public:
Virtual void navigateerror (lpdispatch Pdisp, variant * pvurl,
Variant * pvframe, variant * pvstatuscode, variant_bool * pvbcancel );

Virtual void onnavigateerror (maid, maid, DWORD dwerror, bool * pbcancel );

Add the following content to the CPP file:
Begin_eventsink_map (chtmlctrl, chtmlview)
On_event (chtmlctrl, afx_idw_pane_first, dispid_navigateerror, navigateerror, vts_dispatch vts_pvariant vts_pbool)
End_eventsink_map ()

....
Void chtmlctrl: navigateerror (lpdispatch Pdisp, variant * pvurl,
Variant * pvframe, variant * pvstatuscode, variant_bool * pvbcancel)
{
Unused_always (Pdisp );
Assert (pvurl! = NULL );
Assert (pvframe! = NULL );
Assert (pvstatuscode! = NULL );
Assert (pvbcancel! = NULL );
Assert (v_vt (pvurl) = vt_bstr );
Assert (v_vt (pvframe) = vt_bstr );

Cstring strurl (v_bstr (pvurl ));
Cstring strframe (v_bstr (pvframe ));
DWORD dwerror = v_i4 (pvstatuscode );

Bool bcancel = false;
// Define y the user's class
Onnavigateerror (strurl, strframe, dwerror, & bcancel );

If (pvbcancel)
* Pvbcancel = bcancel? Afx_ole_true: afx_ole_false;
}

Void chtmlctrl: onnavigateerror (lpctstr lpszurl, lpctstr lpszframe, DWORD dwerror, bool * pbcancel)
{
// Default to continuing
* Pbcancel = false;

// User will override to handle this notification
Unused_always (lpszurl );
Unused_always (lpszframe );

}

In this way, the chtmlview inheritance class of vc6 has the onnavigateerror response method.

 

 

Reference: http://www.codeguru.com/forum/archive/index.php/t-74676.html

Http://www.itzhe.cn/article/20080119/57559.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.