C++, MFC

MFC: CButton and how ON_BN_DOUBLECLICKED message map works

Microsoft Foundation Classes (MFC) library provides CButton which, according to MSDN, can be used for creating a check box, a radio button, and a pushbutton.

There are two events CButton supports: (i) ON_BN_CLICKED (single click), (ii) ON_BN_DOUBLECLICKED (double click). Let’s assume you provide a meaningful implementation for a single click and do nothing in the event handler for the double …


Initializer list and initializing derived class members

Initializer list in C++ looks like in the example below (see constructor od D class):

class B {
    B() { } 

class D : public B {
    int x;
    int y;

    D(int _x , int _y) : x(_x) , y(_y +1) { }

Now, what if class B had a protected member (z), which you had …