Exit via X on title bar

Exit via X on title bar

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

3 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

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.

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.


Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi