Modality, part 2: Code-modality vs UI-modality
Last time, we saw an example of code that was UI-modal but not code-modal. The opposite is also true: You can have code-modality without UI-modality. In fact, this is far more common than the UI-modal-but-not-code-modal scenario.
You encounter modal loops without a visible change in UI state when you drag the scroll bar thumb, drag the window caption, display a pop-up menu, or initiate an OLE drag/drop operation, among other places. Any time a nested message loop is constructed, you have code modality.
One example is given in MSDN, where the
MsgWaitForMultipleObjects function is used to construct a message loop without any modal UI. (We discussed some of the gotchas of the
MsgWaitForMultipleObjects function in an earlier entry.)