I have a MFC mdi application. After the creation of several documents I want at some point to forbid the activation of another document (activation made by using ctrl+tab or by simply click on the client area of another document or something else).
It seems that there are some messages that can be processed in order to accomplish this:
msg = WM_COMMAND
with wParam = SC_NEXT, SC_PREV
, etc .
But the processing of those messages doesn't prevent an activation made by clicking on the client of another document. For this case all the notification are received after the actual activation is made.
Until now the only solution I found is to use a mouse hook, but I would prefer something more elegant.
How can I completely stop the activation of another document (via a mouse click or otherwise) ?
Reactivating the previous document is not an acceptable solution.
Try responding to the WM_MOUSEACTIVATE
message and return MA_NOACTIVATE
or MA_NOACTIVATEANDEAT
.