how checking/unchecking in a popupmenu

I cannot modified the MENUITEM "&Hide/Show Icon", IDC_HIDE_ICONS
for checking or unchecking.
how making?

my popupmenu is initialised in class CDialog:

int CClrBgDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;

// assign a menu, icon, tooltip, and handler to the tray icon.
if ( ! m_classTrayNotifyIcon . Create ( this, IDR_POPUP, "ClearBg", AfxGetApp () -> LoadIcon ( IDI_TRAYICON ), WM_TRAYNOTIFY ) ) {
AfxMessageBox ( "Failure Creating Tray Icon", MB_ICONSTOP );
return -1;
}
return 0;
}

// pass the tray notification message to the tray icon object for handling.
LRESULT CClrBgDlg::OnTrayNotify ( WPARAM wParam, LPARAM lParam ) {
return m_classTrayNotifyIcon . OnTrayNotification ( wParam, lParam );
SetForegroundWindow();
}

void CMyDlg::OnUpdateHideIconsDesk(CCmdUI* pCmdUI)
{
if(t_icon == TRUE) pCmdUI->SetCheck(1);
else
if(t_icon == FALSE) pCmdUI->SetCheck(0);
}

rc file:
IDR_POPUP MENU DISCARDABLE
BEGIN
POPUP "P&OPUP"
BEGIN
MENUITEM "&Dialog Properties...", IDC_SHOW_MAIN
MENUITEM SEPARATOR
MENUITEM "C&hoose Colors...", IDC_COLOR
MENUITEM "&Hide/Show Icon", IDC_HIDE_ICONS
MENUITEM "&About ClearBg...", ID_APP_ABOUT
MENUITEM SEPARATOR
MENUITEM "&Remove From Memory...", IDC_REMOVE_MEMORY
END
END
[1595 byte] By [Osterreicher] at [2007-11-17 0:47:23]
# 1 Re: how checking/unchecking in a popupmenu
Try handling CMyDlg's WM_INITMENUPOPUP message, and then call the relevant set/check functions there directly on the CMenu* passed to you.

Roger Allen
Roger.Allen@sirius-analytical.com
I would like to think I helped, but I have trouble doing even that.
Roger Allen at 2007-11-10 6:46:21 >
# 2 Re: how checking/unchecking in a popupmenu
thanks for your response of my probleme
whith check/uncheck a popupmenu.

I make this paragraph and is good. thank you.

void CMyDlg::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)

{

CDialog::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);

if(t_icon == TRUE)

pPopupMenu->CheckMenuItem(IDC_HIDE_ICONS_DESK, MF_CHECKED);

else

if(t_icon == FALSE)

pPopupMenu->CheckMenuItem(IDC_HIDE_ICONS_DESK, MF_UNCHECKED);

}
Osterreicher at 2007-11-10 6:47:21 >