Thanks for your help klepto2.
What you're saying makes sense, and I can run the code you provided with the desired outcome. However, in my code(and I'm using IGlass) what happens is that as soon as the person clicks the close button, the window disappears and is no longer in the tray at the bottom. Then the messagebox appears on top of the desktop. If I choose "yes" the program stops execution. If I choose "no" the program is still running but my desktop doesn't come back. Something else I noticed was that the cursor goes behind the messagebox, but the clicks register when you click over the buttons. If anyone has any other thoughts, please let me know. Thanks
What you're saying makes sense, and I can run the code you provided with the desired outcome. However, in my code(and I'm using IGlass) what happens is that as soon as the person clicks the close button, the window disappears and is no longer in the tray at the bottom. Then the messagebox appears on top of the desktop. If I choose "yes" the program stops execution. If I choose "no" the program is still running but my desktop doesn't come back. Something else I noticed was that the cursor goes behind the messagebox, but the clicks register when you click over the buttons. If anyone has any other thoughts, please let me know. Thanks