ON_UPDATE_COMMAND_UI for Modeless Dialogs
Modeless dialogs can't automatically use the WM_KICKIDLE message to start idle processing. This is because MFC uses it's own model dialog message loop that sends WM_KICKIDLE messages. But modeless dialogs use the standard dialog message loop in Windows. This one doesn't send WM_KICKIDLE messages.
So by taking a look at how MFC allows dialog bars to do idle processing, this is the best I can come up with.
1. Keep a pointer to the modeless dialog in the parent window that created the dialog. Frame or view.
2. In the parent window add a message map for WM_IDLEUPDATECMDUI. This message is pumped out by the app's OnIdle loop.
3. Send WM_IDLEUPDATECMDUI to the modeless dialog from the parent's OnIdleUpdateCmdUI function.
4. Add a message map for WM_IDLEUPDATECMDUI in the dialog and call UpdateDialogControls
5. Use ON_UPDATE_COMMAND_UI message maps as needed.
Notes:
WM_IDLEUPDATECMDUI is defined in afxpriv.h.
You could send the dialog WM_KICKIDLE messages. I just used WM_IDLEUPDATECMDUI to fit in with the way MFC does things.
Legacy CodeGuru | 10/07/1998 12:00am


Originally posted by:
Tim McColl