pythiyam
pythiyam

Reputation: 41

Why is the modal dialog in MFC actually internally modeless?

This question arose in my miind after reading this article: http://www.codeproject.com/Articles/3911/The-singular-non-modality-of-MFC-modal-dialogs. He mentions that the modal dialog in MFC is not strictly modal, but implemented as a modeless dialog(internally) with bells and whistles to make it behave as a modal one.

Specifically, he says:

The MFC command routing mechanism uses a combination of message maps and virtual functions to achieve what it does and a true modal dialog will totally wreck this mechanism because then the modal message loop is controlled outside the scope of the MFC command routing machinery

Could anyone elucidate this statement? An example of what would have gone wrong if they had tried to implement a truly modal dialog would greatly clear things up.

Upvotes: 1

Views: 479

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409176

A modal dialog stops your message loop, but there must still be a message loop to handle the events for the dialog. So a modal dialog simply a non-modal dialog with its own internal message loop.

Upvotes: 2

Related Questions