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
W.Presser

3 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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.

Jugoslav
www.xeffort.com

发表评论

登录添加评论。还不是成员?立即加入