Welcome to the QAP forum dhruv.
This is the expected dialog box behavior when it is displayed with the "yes/no" property. See
MB_YESNO. I will change it to MB_YESNOCANCEL if having to click No is an issue. With this option, the X button remains enabled.