简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM