Using ON_UPDATE_COMMAND_UI with controls
In a dalog class header, add the following in the message map:
afx_msg LRESULT OnKickIdle(WPARAM , LPARAM );
In the implementation file:
#include <afxpriv.h>
In the message map add:
ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
Implement the function:
LRESULT CMyDlg::OnKickIdle(WPARAM wParam, LPARAM lParam)
{
UpdateDialogControls(this, FALSE);
return 0;
}
I leave the bDisableIfNoHndler flag as FALSE so buttons without message map entries are not disabled.
You can now use ON_UPDATE_COMMAND_UI message maps for enabling/disabling controls, setting static text, etc.
It works really well when you have two or more radio buttons that enable/disable different groups of controls. Just have one OnUpdate... function for each group of controls that enables/disables depending on the radio button selected, use IsDlgButtonChecked. Then add a message map entry for each control.
To use ON_UPDATE_COMMAND_UI in form views.
The kick idle message doesn't work in form views, but there's another message in afxpriv.h called WM_IDLEUPDATECMDUI, that does.
In a form view class header, add the following in the message map:
afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM , LPARAM );
In the implementation file:
#include <afxpriv.h>
In the message map add:
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
Implement the function:
LRESULT CMyFormView::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM)
{
UpdateDialogControls(this, FALSE);
return 0L;
}
ON_UPDATE_COMMAND_UI can now be used as described above.
Updated 21 March 1998

Comments
Nike Draught Max+instagram, at one's desire you confine the color to bear up on your feet!
Posted by madytreathy on 04/24/2013 05:45pmRecollect in 2008, if not earlier, when Nike launched ahead of the self-assured shoe color projects, the catchword "Whiz Your Colours", "Nike PhotoiD" scheme, [url=http://markwarren.org.uk/goodbuy.cfm]nike free run uk[/url] response has not been as hearty as expected. Have in mind, 2008 Canon IXUS 80 IS Digital prankster arcade but one 8 million pixels, Nokia, the mobile phone superstore is the at worst administration, NikeiD was support to color in the photos as a essence someone is concerned sneakers excise color, although exciting, but does provoke some. Instagram which communicate this item make sport and fundamental, Nike PHOTOiD homeopathic upgrade customization services, recently [url=http://markwarren.org.uk/goodbuy.cfm]nike free run uk[/url] released a new plan. That such iD can you realize pictures as instagram account shoe color, temporarily make available Nike Breeze Max shoes and Nike Style Max 1, Nike Feeling Max 90 953 options. Interested in children's shoes, you [url=http://markwarren.org.uk/goodbuy.cfm]nike free run[/url] can without exception vanish into thin air's valid website photoid.Nike.com, in besides to flip other people's originative work, or you can struggle to upload your own instagram photo, build your own Nike Mood Max.
ReplyUpdateCmdUI for a modeless dialog in a dialog based application
Posted by Legacy on 04/06/2000 12:00amOriginally posted by: Anna
I tried this code for my dialog based application.
i dont have a frame wnd here but applied all the steps to the main dialog class instead of the frame wnd.
please see the code:
In the main dialog class, i put this message map entry and a handler to it.
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
LRESULT CMyDlg1::OnIdleUpdateCmdUI(WPARAM wParam,
LPARAM lParam)
{
m_pViewDoc->SendMessage(WM_IDLEUPDATECMDUI);
return 0L;
}
m_pViewDoc is a pointer to the modeless dialog(CViewDoc) which has a toolbar that needs the updatecmdUI.
In the Modeless dialog i have the following code:
ON_MESSAGE(WM_KICKIDLE, OnKickIdle) in the message map entry of this class.
LRESULT CViewDoc::OnKickIdle(WPARAM wParam, LPARAM lParam)
Reply{
UpdateDialogControls(this, FALSE);
return 0;
}
I have UpdateCmdUI handlers for the toolbar buttons .
this does not work . can anyone help me out.
thanks.
Anna
Default() might be fine
Posted by Legacy on 01/29/2000 12:00amOriginally posted by: Petr Novotny
ReplyON_UPDATE_COMMAND_UI for Modeless Dialogs
Posted by Legacy on 10/07/1998 12:00amOriginally posted by: Tim McColl
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:
ReplyWM_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.