I just tested it, and it seems to work alright. With OK / Cancel buttons, clicking the X in the messagebox window triggers Cancel, and with just an OK button, clicking the X triggers OK. This is intentional, and Windows tells you that OK was clicked if you use the X on a messagebox with just an OK button, so it's obviously intentional.