Tutorial :How to Determine Resource-ID of the CMFCRibbonButton using NMHDR Structure?



Question:

I implemented my own CMFCToolTipCtrl class in order to modify enhanced tooltip in Ribbon Control.But I'm unable to determine Resource ID from NMHDR Structure.How to get it ?

////////////////////////////// MainApp.cpp //////////////////////////////

CMFCToolTipInfo ttParams;

ttParams.m_bVislManagerTheme =FALSE;

theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(MTP_CMFCToolTipCtrl), &ttParams);

////////////////////////////// MTP_CMFCToolTipCtrl.cpp //////////////////////////////

BEGIN_MESSAGE_MAP(MTP_CMFCToolTipCtrl, CMFCToolTipCtrl) ON_NOTIFY_REFLECT(TTN_SHOW, OnShow) ON_WM_SETFOCUS() END_MESSAGE_MAP()

void MTP_CMFCToolTipCtrl::OnShow(NMHDR* pNMHDR, LRESULT* pResult)

{

int m_nCurrID=?

// How to Determine Resource-ID of the CMFCRibbonButton using NMHDR-structure ??

switch (m_nCurrID) {

case ID_EDIT_PASTE:      SetDescription (_T("paste button description..."));      break;    case ID_EDIT_CUT:      SetDescription (_T("cut button description..."));      break;    default:      SetDescription (_T (""));    }    CMFCToolTipCtrl::OnShow (pNMHDR, pResult);  

}


Solution:1

problem solved..by implementing

CMFCToolBarImages* CMainFrame::GetTooltipImage(UINT uiID) {} // in Main.cpp

CSize MTP_CMFCToolTipCtrl::GetIconSize()

{

CMFCToolBarImages* pBmp = ((CMainFrame*)GetTopLevelFrame())->GetTooltipImage(m_nID);

................

................

}

...for more help please refer MSOffice2007Demo sample of MFC Feature Pack 2008.... thank you.. :|


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »