Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Exit via X on title bar

presser
Beginner
434 Views
Simular to the question of pmichael from Jul 1,2002 I got a problem in my QuickWin application using 'officially not allowed' modeless dialog boxes, which works just fine, so far. However when the user clicks on the Title Bar X of the dialog box, the window does not disappear like with the Cancel or OK button. I can intercept WM_COMMAND and call EXIT, but this ends only the doloop for the messages. Can I do anything to resolve this problem?
Thank you very much
W.Presser
0 Kudos
2 Replies
david_jones
Beginner
434 Views
One approach is to set a flag in a common block or module when the X button is pressed and put a test for this flag in your main loop and stop or call exit from there. Depending on your structure, you may need to modify things so the the test is done only ever tenth of a second or so, rather than continually ... i.e. avoid expending all the CPU time on doing the test.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
434 Views
Does your PROGRAM end with a message loop or is it located elsewhere? If the latter (which is my guess since I wouldn't expect such behaviour with the first approach), try intercepting WM_CLOSE of the main window and insert a PostQuitMessage there before calling CallWindowProc. That PostQuitMessage should cause secondary message loop to exit.

Just a guess, didn't try it myself.
0 Kudos
Reply