I have a CButton that I have sub-classed (in order to change the colour of it). Now the users of this button may press it quite rapidly (it changes a page on a form) but when this happens to quickly, MFC fires the BN_DBLCLK message. I want to be able to disable this so no matter how quickly the button is pressed only a BN_CLICKED event is sent. I had an idea to use this code by hooking into the BN_DBLCLK message and then sending a BN_CLICKED message:
1 2 3 4 5
void CColourButton::OnBnDoubleclicked()
{
// TODO: Add your control notification handler code here
this->SendMessageA(BN_CLICKED);
}