vico
vico

Reputation: 18201

Yes/No instead of OK Cancel

I have MFC dialog form with OK/Cancel buttons. After pressing these buttons form is closed and I have modal result IDOK/IDCANCEL. Now I would like to have buttons that would close form in the same way and return IDYES/IDNO in modal result. How to do that?

Upvotes: 1

Views: 1005

Answers (1)

zar
zar

Reputation: 12247

A dialog provides OnOk() and OnCancel() functionality but not OnYes() or OnNo(). You simply add buttons to implement that yourself and since IDYES and IDNO are defined by MFC you can just call the following:

EndDialog( IDYES ); // when yes is pressed

EndDialog( IDNO ); // when no is pressed

Upvotes: 3

Related Questions