Tag Archive for '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 click (empty method’s body). The result if a single click is obvious, but what will happen if user double clicks the check box (or the other CButton representation)? There are two possible answers (assuming the check box was unchecked initially):

  1. Check box will be checked, and then unchecked – a simulation of a double (single) click
  2. Check box will be checked only – one action takes place now

Continue reading ‘MFC: CButton and how ON_BN_DOUBLECLICKED message map works’