You should check your ShowDialog(); calls return values in order to find out which button was actually pressed.

Something like that


......................................
// Show dlg as a...