In my program I have a menu with an exit button that will pop up a message box that has a YES and NO button controlled with an if statement. Basically a "Are you sure you want to quit" sort of dialog. This only comes up when the user goes to File > Exit because of the switch statement. What I'm trying to accomplish is getting the same dialog box to come up with the same behavior when the user presses the X button in the top right.
I suspect it's somewhere in the WM_DESTROY case but when I put the same messagebox and if statement inside the WM_DESTROY case it closes the window, and then pops up the dialog.