Sajeesh Payolam
Sajeesh Payolam

Reputation: 21

how to handle single click and double on same button in mfc?

In my VC++ project I am using a button in dialog. I already add single click event of a button. Now I want to handle double click event of the same button. So I add ON_BN_DOUBLECLICKED( IDC_BUTTON1, OnDBClick ) for the same button. But it is not working. Can anyone explain it?

Upvotes: 1

Views: 2478

Answers (2)

Mark Ransom
Mark Ransom

Reputation: 308091

From the Microsoft documentation:

This notification code is sent automatically for BS_USERBUTTON, BS_RADIOBUTTON, and BS_OWNERDRAW buttons. Other button types send BN_DOUBLECLICKED only if they have the BS_NOTIFY style.

So set the BS_NOTIFY style on the button.

Upvotes: 1

rkosegi
rkosegi

Reputation: 14618

Look here: http://www.codeproject.com/Articles/2488/Getting-BN_DOUBLECLICK-to-work-for-buttons

Article describe how to make it work.

Upvotes: 1

Related Questions