void CMailSearchDlg::PopupMenu()
{
CPoint point2;
::GetCursorPos(&point2);
CPoint menupoint = point2;
ScreenToClient(&point2);
CMenu menu;
menu.LoadMenu(IDR_MENU_EMAILLIST);
CMenu *pSubMenu = menu.GetSubMenu(0);
if (pSubMenu != NULL)
{
int nSelectCount = m_wndEmailList.GetSelectedCount();
if ( nSelectCount == 0 )
{
pSubMenu->EnableMenuItem(ID_MENU_COPYEMAIL, MF_GRAYED | MF_BYCOMMAND | MF_DISABLED);
}
if ( 0 == m_wndEmailList.GetItemCount() )
{
pSubMenu->EnableMenuItem(IDC_BUTTON_EXPORT, MF_GRAYED | MF_BYCOMMAND | MF_DISABLED);
pSubMenu->EnableMenuItem(IDC_BUTTON_EMPTY, MF_GRAYED | MF_BYCOMMAND | MF_DISABLED);
}
pSubMenu->TrackPopupMenu(TPM_RIGHTBUTTON, menupoint.x, menupoint.y, this);
pSubMenu->DestroyMenu();
}
}
阅读(2152) | 评论(0) | 转发(0) |