mfc - AfxMessageBox function triggers a click-event twice -


i have mfc application afxmessagebox called inside event handler of radio-button. ‘yes’, ‘no’ or ‘cancel’ button pressed on message-box close it, event handler called again automatically. leads instance of afxmessagebox getting called. time closing message-box, leads regular flow. ‘auto’ property of radio-button set false per other functionality of application. wondering, why closing message-box causing event related radio-button event handler.

void cmfcapplication3dlg::onbnclickedradio1() {      int answer;     answer = afxmessagebox(_t("save changes?"), mb_yesnocancel);     checkradiobutton(idc_radio1,idc_radio2,idc_radio1); } 

here sequence of steps:

  • radio button clicked, control comes event handler function - onbnclickedradio1
  • messagebox displayed (via afxmessagebox call)
  • when yes, no or cancel button pressed, message box disappears control comes backs onbnclickedradio1 function, without executing ‘checkradiobutton’ call.
  • the message-box appears second time.
  • when yes, no or cancel button pressed, message box disappears. time, ‘checkradiobutton’ executed , handler exits.


Comments