How to add a message handler function in VC _ function

Source: Internet
Author: User

To add a message to a window WM_ERASEBKGND the handler function

VC6.0

1,

A. First, to add the OnEraseBkgnd function (WM_ERASEBKGND) for the convenience of using the erase background below

Press the shortcut key Ctrl+w Open ClassWizard dialog box (or menu->view->classwizard): Select Class Info, find the lower left corner of the MessageFilter, Drop-down list to the bottom, select window, OK save;

B. Let's ctrl+w Open the ClassWizard dialog box, Messagemaps->classname: Select the current Project dialog->objectids: Select the current dialog->messages: Drop it, wm_. Erasebkgnd have a bar, double-click or addfunction, add to the following member functions, double-click on the function code can be edited;

2, of course, in addition to the above methods, if the basic understanding of the code structure, you can also manually increase:

A, the project header file to increase the definition of background function erase

afx_msg BOOL OnEraseBkgnd (CDC *PDC);

b, increase the message response

Begin_message_map (C******dlg, CDialog)//c******dlg is your own dialog box of the engineering class

......

On_wm_erasebkgnd ()

End_message_map ()

C, Engineering source file CPP Add the Operations section of this function

Boolcdisplaybmpbackgrounddlg::onerasebkgnd (CDC *PDC)

{

Here you want to add those things to the background of the picture, just fill it out guohaiyang.blog.163.com

return TRUE;

}

VS2008:

1. In ' Resource View ', open a window, click in the window blank.

2. In the right property manager to select the Message page, will display all can add messages, find WM_ERASEBKGND, click the next Drop-down box, you will see Add OnEraseBkgnd item, click can successfully add WM_ERASEBKGND processing function

BOOL crtspsampledlg::onerasebkgnd (cdc* PDC)
{
TODO: Add the message Handler code here and/or call the default value

Return Cdialog::onerasebkgnd (PDC);
}
Note: VS2008 to manually add a message handler function is similar to VC6.


From the East son of the blog



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.