Prevent a CButton from double clicking

Hi all,

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);
}


But this did not seem to do the trick.

Many thanks for your help!
Matt
Last edited on
Topic archived. No new replies allowed.